From a394816a7b176191ec66a73cb83da0a3a4fd758e Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Thu, 19 Sep 2024 16:13:31 +0930 Subject: [PATCH] remove old files (#23) --- .github/workflows/check.yaml | 12 ++++- Makefile | 44 ------------------- rename.sh | 13 ------ .../tests/bundles/overlays/focal.yaml.j2 | 1 + .../tests/bundles/overlays/jammy.yaml.j2 | 3 +- .../overlays/local-charm-overlay.yaml.j2 | 3 -- tox.ini | 12 +---- 7 files changed, 14 insertions(+), 74 deletions(-) delete mode 100644 Makefile delete mode 100755 rename.sh delete mode 100644 tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index b2bbc95..32e6445 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -83,7 +83,7 @@ jobs: fail-fast: false matrix: runs-on: [[ubuntu-22.04]] - test-command: ['make functional'] + test-command: ['tox -e func'] juju-channel: ["3.4/stable"] steps: @@ -116,8 +116,16 @@ jobs: echo "TEST_MODEL_CONSTRAINTS=arch=arm64" >> "$GITHUB_ENV" fi + - name: Build the charm + run: charmcraft -v pack + - name: Run tests - run: ${{ matrix.test-command }} + run: | + export CHARM_PATH_JAMMY="$(pwd)/$(ls | grep '.*22.04.*\.charm$')" + echo "$CHARM_PATH_JAMMY" + export CHARM_PATH_FOCAL="$(pwd)/$(ls | grep '.*20.04.*\.charm$')" + echo "$CHARM_PATH_FOCAL" + ${{ matrix.test-command }} env: TEST_JUJU3: "1" # https://github.com/openstack-charmers/zaza/pull/653 TEST_JUJU_CHANNEL: ${{ matrix.juju-channel }} diff --git a/Makefile b/Makefile deleted file mode 100644 index fc938c0..0000000 --- a/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -JUJU_REPOSITORY=$(dir $(realpath $(MAKEFILE_LIST))) -CHARM_NAME=$(shell cat ${JUJU_REPOSITORY}/metadata.yaml | grep -E "^name:" | awk '{print $$2}') - -help: - @echo "This project supports the following targets" - @echo "" - @echo " make help - show this text" - @echo " make lint - run flake8" - @echo " make unittests - run the tests defined in the unittest subdirectory" - @echo " make test - run the functests and lint" - @echo " make functional - run the tests defined in the functional subdirectory" - @echo " make release - build the charm" - @echo " make clean - remove unneeded files" - @echo "" - -lint: - @echo "Running flake8" - @-tox -e lint - -unittests: - @echo "No unit tests available at the moment" - -test: lint functional - -functional: build - @JUJU_REPOSITORY=$(JUJU_REPOSITORY) tox -e func -- ${FUNC_ARGS} - -build: - @echo "Building charm to base directory $(JUJU_REPOSITORY)" - @charmcraft pack --verbose - @bash -c ./rename.sh - -release: clean build - @echo "Charm is built at $(JUJU_REPOSITORY)/$(CHARM_NAME).charm" - -clean: - @echo "Cleaning files" - @rm -rf .tox - @find . -iname __pycache__ -exec rm -r {} + - @$(RM) $(JUJU_REPOSITORY)/$(CHARM_NAME).charm - -# The targets below don't depend on a file -.PHONY: lint test functional functional31 build release clean help - diff --git a/rename.sh b/rename.sh deleted file mode 100755 index a960739..0000000 --- a/rename.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -charm=$(grep -E "^name:" ./metadata.yaml | awk '{print $2}') -echo "renaming ${charm}_*.charm to ${charm}.charm" -echo -n "pwd: " -pwd -ls -al -echo "Removing previous charm if it exists" -if [[ -e "${charm}.charm" ]]; -then - rm "${charm}.charm" -fi -echo "Renaming charm here." -mv ${charm}_*.charm ${charm}.charm diff --git a/tests/functional/tests/bundles/overlays/focal.yaml.j2 b/tests/functional/tests/bundles/overlays/focal.yaml.j2 index 132c306..76688c7 100644 --- a/tests/functional/tests/bundles/overlays/focal.yaml.j2 +++ b/tests/functional/tests/bundles/overlays/focal.yaml.j2 @@ -1,5 +1,6 @@ series: focal applications: {{ charm_name }}: + charm: "{{ CHARM_PATH_FOCAL }}" options: juju-channel: {{ TEST_JUJU_CHANNEL }} diff --git a/tests/functional/tests/bundles/overlays/jammy.yaml.j2 b/tests/functional/tests/bundles/overlays/jammy.yaml.j2 index 17d3cdc..e042199 100644 --- a/tests/functional/tests/bundles/overlays/jammy.yaml.j2 +++ b/tests/functional/tests/bundles/overlays/jammy.yaml.j2 @@ -1,5 +1,6 @@ series: jammy applications: {{ charm_name }}: + charm: "{{ CHARM_PATH_JAMMY }}" options: - juju-channel: {{ TEST_JUJU_CHANNEL }} \ No newline at end of file + juju-channel: {{ TEST_JUJU_CHANNEL }} diff --git a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 deleted file mode 100644 index 504d415..0000000 --- a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 +++ /dev/null @@ -1,3 +0,0 @@ -applications: - {{ charm_name }}: - charm: "{{ JUJU_REPOSITORY }}/{{ charm_name }}.charm" diff --git a/tox.ini b/tox.ini index 2f6baed..e497957 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,8 @@ basepython = python3 passenv = HOME OS_* - JUJU_REPOSITORY TEST_* + CHARM_* setenv = PYTHONPATH = . @@ -25,16 +25,6 @@ deps = -r {toxinidir}/tests/functional/requirements.txt commands = functest-run-suite --keep-faulty-model {posargs} -[testenv:func-smoke] -commands = - functest-run-suite --keep-faulty-model --smoke -deps = -r{toxinidir}/test-requirements.txt -passenv = - HOME - JUJU_REPOSITORY - OS_* - TEST_* - [testenv:lint] commands = black --check reactive lib tests