Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support juju 3.4 #26

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
- "**.md"
- "**.rst"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint-unit:
uses: canonical/bootstack-actions/.github/workflows/lint-unit.yaml@v2
Expand All @@ -18,7 +22,6 @@ jobs:
python-version: ["3.8", "3.10"]
with:
python-version: ${{ matrix.python-version }}
tox-version: "<4"
working-directory: ./src

func:
Expand All @@ -28,13 +31,12 @@ jobs:
fail-fast: false
matrix:
include:
- juju-channel: "3.1/stable"
command: "make functional"
- juju-channel: "3.4/stable"
command: "TEST_JUJU3=1 make functional" # using TEST_JUJU3 due https://github.com/openstack-charmers/zaza/commit/af7eea953dd5d74d3d074fe67b5765dca3911ca6
with:
command: ${{ matrix.command }}
juju-channel: ${{ matrix.juju-channel }}
nested-containers: false
provider: "lxd"
python-version: "3.10"
timeout-minutes: 120
tox-version: "<4"
21 changes: 6 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ help:
@echo " make release - run clean, submodules, and build targets"
@echo " make lint - run flake8 and black --check"
@echo " make black - run black and reformat files"
@echo " make proof - run charm proof"
@echo " make unittests - run the tests defined in the unittest subdirectory"
@echo " make functional - run the tests defined in the functional subdirectory"
@echo " make test - run lint, proof, unittests and functional targets"
@echo ""

clean:
@echo "Cleaning files"
@git clean -ffXd -e '!.idea'
@echo "Cleaning existing build"
@rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}
@echo "Cleaning charmcraft"
@charmcraft clean
@echo "Cleaning existing chamr files"
@rm -rf ${PROJECTPATH}/${CHARM_NAME}.charm

submodules:
Expand All @@ -48,15 +45,13 @@ submodules-update:
@git submodule update --init --recursive --remote --merge

build: clean submodules-update
@echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
@echo "Building charm ${PROJECTPATH}/${CHARM_NAME}.charm"
@-git rev-parse --abbrev-ref HEAD > ./src/repo-info
@charmcraft -v pack ${BUILD_ARGS}
@bash -c ./rename.sh
@mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
@unzip ${PROJECTPATH}/${CHARM_NAME}.charm -d ${CHARM_BUILD_DIR}/${CHARM_NAME}

release: clean build
@echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"
@echo "Charm is built at ${PROJECTPATH}/${CHARM_NAME}.charm"

lint:
@echo "Running lint checks"
Expand All @@ -66,17 +61,13 @@ black:
@echo "Reformat files with black"
@cd src && tox -e black

proof: build
@echo "Running charm proof"
@charm proof ${CHARM_BUILD_DIR}/${CHARM_NAME}

unittests:
@echo "Running unit tests"
@cd src && tox -e unit

functional: build
@echo "Executing functional tests in ${CHARM_BUILD_DIR}"
@cd src && CHARM_LOCATION=${PROJECTPATH} tox -e func
@echo "Executing functional tests with ${PROJECTPATH}/${CHARM_NAME}.charm"
@cd src && CHARM_LOCATION=${PROJECTPATH} tox -e func -- ${FUNC_ARGS}

test: lint proof unittests functional
@echo "Tests completed for charm ${CHARM_NAME}."
Expand Down
3 changes: 0 additions & 3 deletions src/CONTRIB.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ make build
charm build
```

You can set various environment variables (e.g. JUJU_REPOSITORY, CHARM_BUILD_DIR) to build into
your desired directory. By default, the project will build into /tmp/charm-builds/duplicity.

## Running Tests

The following section will review running automated tests in the project.
Expand Down
1 change: 0 additions & 1 deletion src/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ tags:
# https://jujucharms.com/docs/stable/authors-charm-metadata
- backup
subordinate: true
series: []
provides:
nrpe-external-master:
interface: nrpe-external-master
Expand Down
4 changes: 4 additions & 0 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
croniter
pidfile
fabric
# NOTE(rgildein): The contextvars could not be installed without this requirement to be specified.
setuptools>=42
# NOTE(rgildein): The typing-extensions could not be installed without this requirement to be specified.
flit-core>=3
2 changes: 1 addition & 1 deletion src/tests/functional/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flake8
mock
git+https://github.com/openstack-charmers/zaza.git@libjuju-3.1#egg=zaza
git+https://github.com/openstack-charmers/zaza.git@master#egg=zaza
python-openstackclient
2 changes: 1 addition & 1 deletion src/tests/functional/tests/bundles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ applications:
charm: nrpe

duplicity:
charm: /tmp/charm-builds/duplicity
charm: duplicity
options:
backend: file
remote_backup_url: 'file:///home/ubuntu/somedir'
Expand Down
5 changes: 2 additions & 3 deletions src/tests/functional/tests/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ def set_ssh_password_access_on_backup_host():
"""Configure ssh access with password on backup host."""
backup_host_unit = _get_unit("backup-host")
command = (
"sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' "
"/etc/ssh/sshd_config && "
"service sshd reload"
'echo "PasswordAuthentication yes" > '
"/etc/ssh/sshd_config.d/01-test-settings.conf && service sshd reload"
)
result = zaza.model.run_on_unit(backup_host_unit.name, command, timeout=15)
_check_run_result(result)
Expand Down
17 changes: 5 additions & 12 deletions src/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,8 @@ passenv =
NO_PROXY
SNAP_HTTP_PROXY
SNAP_HTTPS_PROXY
OS_REGION_NAME
OS_AUTH_VERSION
OS_AUTH_URL
OS_PROJECT_DOMAIN_NAME
OS_USERNAME
OS_PASSWORD
OS_PROJECT_ID
OS_USER_DOMAIN_NAME
OS_PROJECT_NAME
OS_IDENTITY_API_VERSION
OS_*
TEST_*

[testenv:lint]
commands =
Expand Down Expand Up @@ -84,5 +76,6 @@ deps = -r{toxinidir}/tests/unit/requirements.txt

[testenv:func]
changedir = {toxinidir}/tests/functional
commands = functest-run-suite --keep-faulty-model {posargs}
deps = -r{toxinidir}/tests/functional/requirements.txt
commands = functest-run-suite {posargs:--keep-faulty-model}
deps =
-r {toxinidir}/tests/functional/requirements.txt
4 changes: 4 additions & 0 deletions src/wheelhouse.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
distro<1.7.0
croniter
pidfile
# NOTE(rgildein): The contextvars could not be installed without this requirement to be specified.
setuptools>=42
# NOTE(rgildein): The typing-extensions could not be installed without this requirement to be specified.
flit-core>=3
Loading