diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..7a9e557 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 2c5bfb3..04670c6 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -32,3 +32,5 @@ jobs: - name: Run tests run: tox -e py3 + deploy: + uses: ./.github/workflows/deploy.yml diff --git a/charmcraft.yaml b/charmcraft.yaml index 8035998..e517a7f 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -22,3 +22,6 @@ parts: - libssl-dev - rustc - cargo + charm-binary-python-packages: + - cryptography + - jsonschema diff --git a/test-requirements.txt b/test-requirements.txt index e2637dc..823de1f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,7 @@ coverage flake8 stestr +rabbitmq_admin +git+https://github.com/openstack-charmers/zaza.git@libjuju-3.1#egg=zaza +git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack +ops diff --git a/tests/bundles/smoke.yaml b/tests/bundles/smoke.yaml new file mode 100644 index 0000000..3c245bd --- /dev/null +++ b/tests/bundles/smoke.yaml @@ -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 diff --git a/tests/tests.yaml b/tests/tests.yaml new file mode 100644 index 0000000..1aca2c9 --- /dev/null +++ b/tests/tests.yaml @@ -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: '^$' diff --git a/tox.ini b/tox.ini index 9606489..3a493e9 100644 --- a/tox.ini +++ b/tox.ini @@ -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} @@ -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