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 4 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
39 changes: 27 additions & 12 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 @@ -22,19 +26,30 @@ jobs:
working-directory: ./src

func:
uses: canonical/bootstack-actions/.github/workflows/func.yaml@v2
name: Functional tests
rgildein marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
timeout-minutes: 120
needs: lint-unit
strategy:
fail-fast: false
matrix:
include:
- juju-channel: "3.1/stable"
command: "make functional"
with:
command: ${{ matrix.command }}
juju-channel: ${{ matrix.juju-channel }}
nested-containers: false
provider: "lxd"
python-version: "3.10"
timeout-minutes: 120
tox-version: "<4"
juju-channel: ['3.4/stable']
command: ['TEST_JUJU3=1 make functional'] # using TEST_JUJU3 due https://github.com/openstack-charmers/zaza/commit/af7eea953dd5d74d3d074fe67b5765dca3911ca6
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup Juju ${{ matrix.juju-channel }} LXD environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
juju-channel: ${{ matrix.juju-channel }}
lxd-channel: "5.20/stable" # tmp fix until https://github.com/canonical/charmcraft/issues/1640
- name: Show juju information
run: |
juju version
juju controllers | grep Version -A 1 | awk '{print $9}'
- name: Run functional test
run: ${{ matrix.command }}
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
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#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
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
Loading