diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..b2bddec --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,102 @@ +name: Build/Test + +on: + workflow_call: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: python3 -m pip install tox + + - name: Run linters + run: tox -e pep8 + + unit-test: + name: Unit tests + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get -qq install libxslt-dev libxml2-dev python3-lxml + python -m pip install tox + + - name: Run tests + run: tox -e py3 + + build: + name: Build the charm + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup LXD + uses: canonical/setup-lxd@v0.1.1 + with: + channel: 5.20/stable + + - name: Install dependencies + run: python -m pip install tox + + - name: Build charm(s) + id: builder + run: | + sudo snap install charmcraft --classic + tox -e build + + - name: Upload built charm + uses: actions/upload-artifact@v3 + with: + name: charms + path: "*.charm" + + functional-test: + needs: + - lint + - unit-test + - build + name: Functional tests + runs-on: ubuntu-latest + steps: + + - name: Download charm + uses: actions/download-artifact@v3 + with: + name: charms + path: ~/artifacts/ + + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup LXD + uses: canonical/setup-lxd@v0.1.1 + with: + # pin lxd to LTS release. + channel: 5.21/stable + + - name: Install dependencies + run: | + python -m pip install tox + sudo snap install juju + mkdir -p ~/.local/share/juju + juju bootstrap localhost + + - name: Run jammy-antelope tests + run: | + date + mv ~/artifacts/ceph-fs.charm ./ + tox -c src -e func-target -- jammy-antelope diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..6e045d5 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,8 @@ +name: PR + +on: + pull_request: + +jobs: + build: + uses: ./.github/workflows/build-and-test.yml diff --git a/src/test-requirements.txt b/src/test-requirements.txt index 9c7afb7..5be64c0 100644 --- a/src/test-requirements.txt +++ b/src/test-requirements.txt @@ -9,4 +9,5 @@ tox # Functional Test Requirements (let Zaza's dependencies solve all dependencies here!) git+https://github.com/openstack-charmers/zaza.git#egg=zaza -git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack +#git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack +git+https://github.com/lmlg/zaza-openstack-tests.git@ceph-fs-standalone#egg=zaza.openstack diff --git a/src/tests/bundles/focal-yoga.yaml b/src/tests/bundles/focal-yoga.yaml deleted file mode 100644 index 970864f..0000000 --- a/src/tests/bundles/focal-yoga.yaml +++ /dev/null @@ -1,44 +0,0 @@ -variables: - openstack-origin: &openstack-origin cloud:focal-yoga - -local_overlay_enabled: False - -series: &series focal - -applications: - ubuntu: # used to test mounts - charm: ch:ubuntu - num_units: 2 - ceph-fs: - charm: ../../../ceph-fs.charm - num_units: 1 - options: - source: *openstack-origin - pool-type: erasure-coded - ec-profile-k: 4 - ec-profile-m: 2 - - ceph-osd: - charm: ch:ceph-osd - num_units: 6 - storage: - osd-devices: 'cinder,10G' - options: - osd-devices: '/dev/test-non-existent' - source: *openstack-origin - channel: quincy/edge - - ceph-mon: - charm: ch:ceph-mon - num_units: 3 - options: - monitor-count: '3' - source: *openstack-origin - channel: quincy/edge - -relations: - - - 'ceph-mon:mds' - - 'ceph-fs:ceph-mds' - - - - 'ceph-osd:mon' - - 'ceph-mon:osd' diff --git a/src/tests/bundles/jammy-antelope.yaml b/src/tests/bundles/jammy-antelope.yaml index 7998dff..6085ec3 100644 --- a/src/tests/bundles/jammy-antelope.yaml +++ b/src/tests/bundles/jammy-antelope.yaml @@ -5,10 +5,23 @@ local_overlay_enabled: False series: &series jammy +machines: + '0': + '1': + constraints: virt-type=virtual-machine mem=4G + '2': + constraints: virt-type=virtual-machine mem=4G + '3': + constraints: virt-type=virtual-machine mem=4G + applications: ubuntu: # used to test mounts charm: ch:ubuntu num_units: 2 + to: + - '2' + - '3' + ceph-fs: charm: ../../../ceph-fs.charm num_units: 1 @@ -17,16 +30,18 @@ applications: pool-type: erasure-coded ec-profile-k: 4 ec-profile-m: 2 + to: + - '2' ceph-osd: charm: ch:ceph-osd - num_units: 6 - storage: - osd-devices: 'cinder,10G' + num_units: 1 options: osd-devices: '/dev/test-non-existent' source: *openstack-origin - channel: quincy/edge + channel: latest/edge + to: + - '1' ceph-mon: charm: ch:ceph-mon @@ -34,7 +49,9 @@ applications: options: monitor-count: '3' source: *openstack-origin - channel: quincy/edge + channel: latest/edge + to: + - '0' relations: - - 'ceph-mon:mds' diff --git a/src/tests/bundles/jammy-bobcat.yaml b/src/tests/bundles/jammy-bobcat.yaml deleted file mode 100644 index 01d8bfc..0000000 --- a/src/tests/bundles/jammy-bobcat.yaml +++ /dev/null @@ -1,44 +0,0 @@ -variables: - openstack-origin: &openstack-origin cloud:jammy-bobcat - -local_overlay_enabled: False - -series: &series jammy - -applications: - ubuntu: # used to test mounts - charm: ch:ubuntu - num_units: 2 - ceph-fs: - charm: ../../../ceph-fs.charm - num_units: 1 - options: - source: *openstack-origin - pool-type: erasure-coded - ec-profile-k: 4 - ec-profile-m: 2 - - ceph-osd: - charm: ch:ceph-osd - num_units: 6 - storage: - osd-devices: 'cinder,10G' - options: - osd-devices: '/dev/test-non-existent' - source: *openstack-origin - channel: reef/edge - - ceph-mon: - charm: ch:ceph-mon - num_units: 3 - options: - monitor-count: '3' - source: *openstack-origin - channel: reef/edge - -relations: - - - 'ceph-mon:mds' - - 'ceph-fs:ceph-mds' - - - - 'ceph-osd:mon' - - 'ceph-mon:osd' diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml index 02ce625..1a0202d 100644 --- a/src/tests/tests.yaml +++ b/src/tests/tests.yaml @@ -1,17 +1,6 @@ charm_name: ceph-fs -gate_bundles: - - focal-xena - - focal-yoga - - jammy-yoga - - jammy-bobcat -smoke_bundles: - - focal-xena -# configure: -# - zaza.openstack.charm_tests.glance.setup.add_lts_image -# - zaza.openstack.charm_tests.neutron.setup.basic_overcloud_network -# - zaza.openstack.charm_tests.nova.setup.create_flavors -# - zaza.openstack.charm_tests.nova.setup.manage_ssh_key -# - zaza.openstack.charm_tests.keystone.setup.add_demo_user +configure: + - zaza.openstack.charm_tests.ceph.osd.tests.setup_osd_standalone tests: - zaza.openstack.charm_tests.ceph.fs.tests.CephFSTests - zaza.openstack.charm_tests.ceph.fs.tests.CharmOperationTest @@ -21,3 +10,15 @@ target_deploy_status: ubuntu: workload-status: active workload-status-message-prefix: '' + + ceph-osd: + workload-status: blocked + workload-status-message: 'No block devices detected using current configuration' + + ceph-fs: + workload-status: waiting + workload-status-message: "'ceph-mds' incomplete" + + ceph-mon: + workload-status: waiting + workload-status-message: 'Monitor bootstrapped but waiting' diff --git a/src/tox.ini b/src/tox.ini index b40d295..49a8b7e 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -27,6 +27,7 @@ minversion = 3.18.0 [testenv] setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 + TEST_JUJU3=1 allowlist_externals = juju passenv = HOME TERM CS_* OS_* TEST_* deps = -r{toxinidir}/test-requirements.txt diff --git a/tox.ini b/tox.ini index 50527f5..4ed093d 100644 --- a/tox.ini +++ b/tox.ini @@ -68,6 +68,7 @@ commands = basepython = python3 deps = -r{toxinidir}/test-requirements.txt commands = stestr run --slowest {posargs} +sitepackages = True [testenv:py35] basepython = python3.5