diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 5df4f72..e018c57 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -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 @@ -18,7 +22,6 @@ jobs: python-version: ["3.8", "3.10"] with: python-version: ${{ matrix.python-version }} - tox-version: "<4" working-directory: ./src func: @@ -28,8 +31,8 @@ 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 }} @@ -37,4 +40,3 @@ jobs: provider: "lxd" python-version: "3.10" timeout-minutes: 120 - tox-version: "<4" diff --git a/Makefile b/Makefile index cb4081c..d053e19 100644 --- a/Makefile +++ b/Makefile @@ -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: @@ -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" @@ -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}." diff --git a/src/CONTRIB.md b/src/CONTRIB.md index 842df2d..51ca9a3 100644 --- a/src/CONTRIB.md +++ b/src/CONTRIB.md @@ -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. diff --git a/src/metadata.yaml b/src/metadata.yaml index f419771..425f00d 100644 --- a/src/metadata.yaml +++ b/src/metadata.yaml @@ -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 diff --git a/src/requirements.txt b/src/requirements.txt index 47e3c05..5d35e6e 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -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 diff --git a/src/tests/functional/requirements.txt b/src/tests/functional/requirements.txt index f0a09b0..fc3c00a 100644 --- a/src/tests/functional/requirements.txt +++ b/src/tests/functional/requirements.txt @@ -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 diff --git a/src/tests/functional/tests/bundles/base.yaml b/src/tests/functional/tests/bundles/base.yaml index b84d3cd..0700e61 100644 --- a/src/tests/functional/tests/bundles/base.yaml +++ b/src/tests/functional/tests/bundles/base.yaml @@ -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' diff --git a/src/tests/functional/tests/configure.py b/src/tests/functional/tests/configure.py index 1bbb104..419452b 100644 --- a/src/tests/functional/tests/configure.py +++ b/src/tests/functional/tests/configure.py @@ -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) diff --git a/src/tox.ini b/src/tox.ini index 226d06d..fd42aa5 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -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 = @@ -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 diff --git a/src/wheelhouse.txt b/src/wheelhouse.txt index e7a5072..c411668 100644 --- a/src/wheelhouse.txt +++ b/src/wheelhouse.txt @@ -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