Skip to content

Commit

Permalink
Merge pull request #6 from gnuoy/add-functional-tests
Browse files Browse the repository at this point in the history
Add functional tests
  • Loading branch information
javacruft authored Jul 10, 2023
2 parents ec17135 + 64b2f77 commit 20c6da3
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: deploy

on:
workflow_call:


jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Tox
run: pip install tox
- name: Setup microk8s
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: 1.26-strict/stable
juju-channel: 3.1/stable
microk8s-addons: hostpath-storage dns rbac metallb:10.64.140.40-10.64.140.49
- name: Install snaps
run: |
sudo snap install --classic terraform
sudo snap install --classic juju-wait
- name: Configure LXD
run: |
sudo groupadd --force --system lxd
sudo usermod --append --groups lxd $USER
sudo snap start lxd
sudo lxd waitready --timeout=30
sudo lxd init --auto
- name: Build Charm
run: |
sg lxd -c "charmcraft -v pack"
mv rabbitmq-k8s*charm rabbitmq-k8s.charm
- name: Run functional tests
run: |
tox -e func-smoke
2 changes: 2 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ jobs:

- name: Run tests
run: tox -e py3
deploy:
uses: ./.github/workflows/deploy.yml
3 changes: 3 additions & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ parts:
- libssl-dev
- rustc
- cargo
charm-binary-python-packages:
- cryptography
- jsonschema
4 changes: 4 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
coverage
flake8
stestr
rabbitmq_admin
git+https://github.com/openstack-charmers/[email protected]#egg=zaza
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack
ops
9 changes: 9 additions & 0 deletions tests/bundles/smoke.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bundle: kubernetes
applications:

rabbitmq:
charm: ../../rabbitmq-k8s.charm
scale: 1
trust: true
resources:
rabbitmq-image: ghcr.io/openstack-snaps/rabbitmq:3.9.13
16 changes: 16 additions & 0 deletions tests/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
gate_bundles:
- smoke
smoke_bundles:
- smoke
tests:
- zaza.openstack.charm_tests.rabbitmq_server.tests_k8s.RabbitMQK8STest
tests_options:
trust:
- smoke
ignore_hard_deploy_errors:
- smoke

target_deploy_status:
rabbitmq:
workload-status: active
workload-status-message-regex: '^$'
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ setenv =
PYTHONPATH = {toxinidir}:{[vars]lib_path}:{[vars]src_path}
passenv =
PYTHONPATH
HOME
install_command =
pip install {opts} {packages}
commands = stestr run --slowest {posargs}
Expand Down Expand Up @@ -126,7 +127,7 @@ commands =
[testenv:func-smoke]
basepython = python3
setenv =
TEST_MODEL_SETTINGS = automatically-retry-hooks=true
TEST_MODEL_SETTINGS = automatically-retry-hooks=true;update-status-hook-interval=1m
TEST_MAX_RESOLVE_COUNT = 5
commands =
functest-run-suite --keep-model --smoke
Expand Down

0 comments on commit 20c6da3

Please sign in to comment.