diff --git a/.gitignore b/.gitignore index 89b0b2d..6328406 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ bin tags *.sw[nop] *.pyc +*.charm tests/cirros-* func-results.json .settings diff --git a/build-requirements.txt b/build-requirements.txt new file mode 100644 index 0000000..b6d2452 --- /dev/null +++ b/build-requirements.txt @@ -0,0 +1,7 @@ +# NOTES(lourot): +# * We don't install charmcraft via pip anymore because it anyway spins up a +# container and scp the system's charmcraft snap inside it. So the charmcraft +# snap is necessary on the system anyway. +# * `tox -e build` successfully validated with charmcraft 1.2.1 + +cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35. diff --git a/charmcraft.yaml b/charmcraft.yaml index ba84f31..11d5f7c 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -6,6 +6,7 @@ parts: source: . prime: - actions/* + - charmhelpers/* - files/* - hooks/* - lib/* diff --git a/osci.yaml b/osci.yaml index 78c47bd..4f97b77 100644 --- a/osci.yaml +++ b/osci.yaml @@ -4,3 +4,7 @@ - charm-unit-jobs-py39 - charm-yoga-functional-jobs - charm-xena-functional-jobs + vars: + needs_charm_build: true + charm_build_name: swift-storage + build_type: charmcraft diff --git a/rename.sh b/rename.sh new file mode 100755 index 0000000..d0c35c9 --- /dev/null +++ b/rename.sh @@ -0,0 +1,13 @@ +#!/bin/bash +charm=$(grep "charm_build_name" osci.yaml | awk '{print $2}') +echo "renaming ${charm}_*.charm to ${charm}.charm" +echo -n "pwd: " +pwd +ls -al +echo "Removing bad downloaded charm maybe?" +if [[ -e "${charm}.charm" ]]; +then + rm "${charm}.charm" +fi +echo "Renaming charm here." +mv ${charm}_*.charm ${charm}.charm diff --git a/test-requirements.txt b/test-requirements.txt index f853625..0aabe17 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -13,11 +13,6 @@ setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb requests>=2.18.4 -# Newer mock seems to have some syntax which is newer than python3.5 (e.g. -# f'{something}' -mock>=1.2,<4.0.0; python_version < '3.6' -mock>=1.2; python_version >= '3.6' - stestr>=2.2.0 # Dependency of stestr. Workaround for diff --git a/tests/bundles/focal-xena.yaml b/tests/bundles/focal-xena.yaml index d747fea..e7fcc40 100644 --- a/tests/bundles/focal-xena.yaml +++ b/tests/bundles/focal-xena.yaml @@ -45,7 +45,7 @@ applications: openstack-origin: *openstack-origin to: - '3' - channel: latest/edge + channel: yoga/edge swift-proxy: charm: ch:swift-proxy @@ -57,7 +57,7 @@ applications: openstack-origin: *openstack-origin to: - '4' - channel: latest/edge + channel: yoga/edge glance: expose: True @@ -67,10 +67,10 @@ applications: openstack-origin: *openstack-origin to: - '5' - channel: latest/edge + channel: yoga/edge swift-storage: - charm: swift-storage + charm: ../../swift-storage.charm num_units: 1 storage: block-devices: 'cinder,10G' diff --git a/tests/bundles/focal-yoga.yaml b/tests/bundles/focal-yoga.yaml index e4e3ed1..2772907 100644 --- a/tests/bundles/focal-yoga.yaml +++ b/tests/bundles/focal-yoga.yaml @@ -45,7 +45,7 @@ applications: openstack-origin: *openstack-origin to: - '3' - channel: latest/edge + channel: yoga/edge swift-proxy: charm: ch:swift-proxy @@ -57,7 +57,7 @@ applications: openstack-origin: *openstack-origin to: - '4' - channel: latest/edge + channel: yoga/edge glance: expose: True @@ -67,10 +67,10 @@ applications: openstack-origin: *openstack-origin to: - '5' - channel: latest/edge + channel: yoga/edge swift-storage: - charm: swift-storage + charm: ../../swift-storage.charm num_units: 1 storage: block-devices: 'cinder,10G' diff --git a/tests/bundles/impish-xena.yaml b/tests/bundles/impish-xena.yaml index 3962786..c10f732 100644 --- a/tests/bundles/impish-xena.yaml +++ b/tests/bundles/impish-xena.yaml @@ -45,7 +45,7 @@ applications: openstack-origin: *openstack-origin to: - '3' - channel: latest/edge + channel: yoga/edge swift-proxy: charm: ch:swift-proxy @@ -57,7 +57,7 @@ applications: openstack-origin: *openstack-origin to: - '4' - channel: latest/edge + channel: yoga/edge glance: expose: True @@ -67,10 +67,10 @@ applications: openstack-origin: *openstack-origin to: - '5' - channel: latest/edge + channel: yoga/edge swift-storage: - charm: swift-storage + charm: ../../swift-storage.charm num_units: 1 storage: block-devices: 'cinder,10G' diff --git a/tests/bundles/jammy-yoga.yaml b/tests/bundles/jammy-yoga.yaml index 1fbcc6a..b51a6d1 100644 --- a/tests/bundles/jammy-yoga.yaml +++ b/tests/bundles/jammy-yoga.yaml @@ -45,7 +45,7 @@ applications: openstack-origin: *openstack-origin to: - '3' - channel: latest/edge + channel: yoga/edge swift-proxy: charm: ch:swift-proxy @@ -57,7 +57,7 @@ applications: openstack-origin: *openstack-origin to: - '4' - channel: latest/edge + channel: yoga/edge glance: expose: True @@ -67,10 +67,10 @@ applications: openstack-origin: *openstack-origin to: - '5' - channel: latest/edge + channel: yoga/edge swift-storage: - charm: swift-storage + charm: ../../swift-storage.charm num_units: 1 storage: block-devices: 'cinder,10G' diff --git a/tests/bundles/overlays/bionic-train-gr-r1.yaml.j2 b/tests/bundles/overlays/bionic-train-gr-r1.yaml.j2 deleted file mode 100644 index f6abe8b..0000000 --- a/tests/bundles/overlays/bionic-train-gr-r1.yaml.j2 +++ /dev/null @@ -1,30 +0,0 @@ -applications: - keystone: - offers: - keystone: - endpoints: - - identity-service - swift-proxy-region1: - offers: - swift-proxy-region1: - endpoints: - - swift-storage - - rings-distributor - swift-storage-region1-zone1: - charm: {{ charm_location }} - offers: - swift-storage-region1-zone1: - endpoints: - - swift-storage - swift-storage-region1-zone2: - charm: {{ charm_location }} - offers: - swift-storage-region1-zone2: - endpoints: - - swift-storage - swift-storage-region1-zone3: - charm: {{ charm_location }} - offers: - swift-storage-region1-zone3: - endpoints: - - swift-storage diff --git a/tests/bundles/overlays/bionic-train-gr-r2.yaml.j2 b/tests/bundles/overlays/bionic-train-gr-r2.yaml.j2 deleted file mode 100644 index 41837d8..0000000 --- a/tests/bundles/overlays/bionic-train-gr-r2.yaml.j2 +++ /dev/null @@ -1,35 +0,0 @@ -applications: - swift-storage-region2-zone1: - charm: {{ charm_location }} - swift-storage-region2-zone2: - charm: {{ charm_location }} - swift-storage-region2-zone3: - charm: {{ charm_location }} -relations: -- - swift-proxy-region2:identity-service - - keystone:identity-service -- - swift-proxy-region2:swift-storage - - swift-storage-region1-zone1:swift-storage -- - swift-proxy-region2:swift-storage - - swift-storage-region1-zone2:swift-storage -- - swift-proxy-region2:swift-storage - - swift-storage-region1-zone3:swift-storage -- - swift-storage-region2-zone1:swift-storage - - swift-proxy-region1:swift-storage -- - swift-storage-region2-zone2:swift-storage - - swift-proxy-region1:swift-storage -- - swift-storage-region2-zone3:swift-storage - - swift-proxy-region1:swift-storage -- - swift-proxy-region2:rings-consumer - - swift-proxy-region1:rings-distributor -saas: - keystone: - url: admin/{{ swift_gr_region1 }}.keystone - swift-proxy-region1: - url: admin/{{ swift_gr_region1 }}.swift-proxy-region1 - swift-storage-region1-zone1: - url: admin/{{ swift_gr_region1 }}.swift-storage-region1-zone1 - swift-storage-region1-zone2: - url: admin/{{ swift_gr_region1 }}.swift-storage-region1-zone2 - swift-storage-region1-zone3: - url: admin/{{ swift_gr_region1 }}.swift-storage-region1-zone3 diff --git a/tox.ini b/tox.ini index 86d1e90..81fd249 100644 --- a/tox.ini +++ b/tox.ini @@ -37,10 +37,20 @@ setenv = VIRTUAL_ENV={envdir} install_command = {toxinidir}/pip.sh install {opts} {packages} commands = stestr run --slowest {posargs} -allowlist_externals = juju +allowlist_externals = + charmcraft + rename.sh passenv = HOME TERM CS_* OS_* TEST_* deps = -r{toxinidir}/test-requirements.txt +[testenv:build] +basepython = python3 +deps = -r{toxinidir}/build-requirements.txt +commands = + charmcraft clean + charmcraft -v build + {toxinidir}/rename.sh + [testenv:py35] basepython = python3.5 deps = -r{toxinidir}/requirements.txt