From aa7a6d9b3c253b15a4d660e0cd87cab891e64190 Mon Sep 17 00:00:00 2001 From: David Ames Date: Tue, 12 Mar 2019 14:58:48 -0700 Subject: [PATCH] Bundles for testing Although, zaza is not yet ready for full automated testing, the bundles provided allow for manual testing of keystone-saml-mellon. --- src/requirements.txt | 8 + src/test-requirements.txt | 33 +--- src/tests/bundles/bionic-queens-ha.yaml | 1 + src/tests/bundles/bionic-queens-smoke-ha.yaml | 1 + src/tests/bundles/bionic-queens-smoke.yaml | 59 +++++++ src/tests/bundles/bionic-queens.yaml | 154 ++++++++++++++++++ .../bundles/overlays/bionic-queens-ha.yaml.j2 | 1 + .../overlays/bionic-queens-smoke-ha.yaml.j2 | 1 + src/tests/bundles/overlays/ha.yaml.j2 | 26 +++ src/tests/tests.yaml | 22 +++ src/tox.ini | 102 +++++++----- 11 files changed, 340 insertions(+), 68 deletions(-) create mode 100644 src/requirements.txt create mode 120000 src/tests/bundles/bionic-queens-ha.yaml create mode 120000 src/tests/bundles/bionic-queens-smoke-ha.yaml create mode 100644 src/tests/bundles/bionic-queens-smoke.yaml create mode 100644 src/tests/bundles/bionic-queens.yaml create mode 120000 src/tests/bundles/overlays/bionic-queens-ha.yaml.j2 create mode 120000 src/tests/bundles/overlays/bionic-queens-smoke-ha.yaml.j2 create mode 100644 src/tests/bundles/overlays/ha.yaml.j2 create mode 100644 src/tests/tests.yaml diff --git a/src/requirements.txt b/src/requirements.txt new file mode 100644 index 0000000..176f68f --- /dev/null +++ b/src/requirements.txt @@ -0,0 +1,8 @@ +pbr>=1.8.0,<1.9.0 +simplejson>=2.2.0 +netifaces>=0.10.4 +netaddr>=0.7.12,!=0.7.16 +Jinja2>=2.6 # BSD License (3 clause) +six>=1.9.0 +dnspython>=1.12.0 +psutil>=1.1.1,<2.0.0 diff --git a/src/test-requirements.txt b/src/test-requirements.txt index 16d0adb..32f84b8 100644 --- a/src/test-requirements.txt +++ b/src/test-requirements.txt @@ -1,33 +1,8 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. -coverage>=3.6 +charm-tools>=2.4.4 +requests>=2.18.4 mock>=1.2 flake8>=2.2.4,<=2.4.1 os-testr>=0.4.1 -charm-tools>=2.0.0 -requests==2.6.0 -# amulet deployment helpers -git+https://github.com/juju/charm-helpers#egg=charmhelpers -# BEGIN: Amulet OpenStack Charm Helper Requirements -# Liberty client lower constraints -amulet>=1.14.3,<2.0 -bundletester>=0.6.1,<1.0 -aodhclient>=0.1.0 -python-barbicanclient>=4.0.1 -python-ceilometerclient>=1.5.0 -python-cinderclient>=1.4.0 -python-designateclient>=1.5 -python-glanceclient>=1.1.0 -python-heatclient>=0.8.0 python-keystoneclient>=1.7.1 -python-manilaclient>=1.8.1 -python-neutronclient>=3.1.0 -python-novaclient>=2.30.1 -python-openstackclient>=1.7.0 -python-swiftclient>=2.6.0 -pika>=0.10.0,<1.0 -distro-info -# END: Amulet OpenStack Charm Helper Requirements -# NOTE: workaround for 14.04 pip/tox -pytz +python-swiftclient +git+https://github.com/openstack-charmers/zaza.git#egg=zaza;python_version>='3.0' diff --git a/src/tests/bundles/bionic-queens-ha.yaml b/src/tests/bundles/bionic-queens-ha.yaml new file mode 120000 index 0000000..2f45b67 --- /dev/null +++ b/src/tests/bundles/bionic-queens-ha.yaml @@ -0,0 +1 @@ +bionic-queens.yaml \ No newline at end of file diff --git a/src/tests/bundles/bionic-queens-smoke-ha.yaml b/src/tests/bundles/bionic-queens-smoke-ha.yaml new file mode 120000 index 0000000..a1c4db4 --- /dev/null +++ b/src/tests/bundles/bionic-queens-smoke-ha.yaml @@ -0,0 +1 @@ +bionic-queens-smoke.yaml \ No newline at end of file diff --git a/src/tests/bundles/bionic-queens-smoke.yaml b/src/tests/bundles/bionic-queens-smoke.yaml new file mode 100644 index 0000000..1ee7b47 --- /dev/null +++ b/src/tests/bundles/bionic-queens-smoke.yaml @@ -0,0 +1,59 @@ +series: bionic +relations: +- - keystone:shared-db + - mysql:shared-db +- - glance:shared-db + - mysql:shared-db +- - glance:identity-service + - keystone:identity-service +- - keystone + - keystone-saml-mellon +- - vault:shared-db + - mysql:shared-db +- - vault:certificates + - keystone:certificates +- - vault:certificates + - glance:certificates +- - vault:certificates + - openstack-dashboard:certificates +- - openstack-dashboard + - keystone-saml-mellon +- - keystone:websso-trusted-dashboard + - openstack-dashboard:websso-trusted-dashboard +- - openstack-dashboard:identity-service + - keystone:identity-service +applications: + mysql: + constraints: mem=3072M + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + keystone: + series: bionic + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + token-provider: 'fernet' + token-expiration: 60 + keystone-saml-mellon: + series: bionic + charm: ../../../keystone-saml-mellon + num_units: 0 + options: + idp-name: 'samltest' + protocol-name: 'mapped' + user-facing-name: "samltest.id" + subject-confirmation-data-address-check: False + nameid-formats: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" + resources: + idp-metadata: "./idp-metadata.xml" + sp-signing-keyinfo: "./sp-signing-keyinfo.xml" + sp-private-key: "./sp-private-key.pem" + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + vault: + num_units: 1 + charm: cs:~openstack-charmers-next/vault + openstack-dashboard: + num_units: 1 + charm: cs:~openstack-charmers-next/openstack-dashboard diff --git a/src/tests/bundles/bionic-queens.yaml b/src/tests/bundles/bionic-queens.yaml new file mode 100644 index 0000000..b840193 --- /dev/null +++ b/src/tests/bundles/bionic-queens.yaml @@ -0,0 +1,154 @@ +relations: +- - nova-compute:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - keystone:shared-db + - mysql:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - glance:identity-service + - keystone:identity-service +- - neutron-api:identity-service + - keystone:identity-service +- - neutron-openvswitch:neutron-plugin-api + - neutron-api:neutron-plugin-api +- - neutron-api:shared-db + - mysql:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-gateway:neutron-plugin-api + - neutron-api:neutron-plugin-api +- - glance:shared-db + - mysql:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:image-service + - glance:image-service +- - nova-compute:image-service + - glance:image-service +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - neutron-openvswitch:amqp + - rabbitmq-server:amqp +- - openstack-dashboard:identity-service + - keystone:identity-service +- - openstack-dashboard:shared-db + - mysql:shared-db +- - nova-cloud-controller:shared-db + - mysql:shared-db +- - nova-cloud-controller:neutron-api + - neutron-api:neutron-api +- - cinder:image-service + - glance:image-service +- - cinder:amqp + - rabbitmq-server:amqp +- - cinder:identity-service + - keystone:identity-service +- - cinder:cinder-volume-service + - nova-cloud-controller:cinder-volume-service +- - cinder:shared-db + - mysql:shared-db +- - ntp:juju-info + - nova-compute:juju-info +- - ntp:juju-info + - neutron-gateway:juju-info +- - keystone + - keystone-saml-mellon +- - vault:shared-db + - mysql:shared-db +- - vault:certificates + - keystone:certificates +- - vault:certificates + - glance:certificates +- - vault:certificates + - openstack-dashboard:certificates +- - openstack-dashboard + - keystone-saml-mellon +- - keystone:websso-trusted-dashboard + - openstack-dashboard:websso-trusted-dashboard +- - vault:certificates + - cinder:certificates +- - vault:certificates + - neutron-api:certificates +- - vault:certificates + - nova-cloud-controller:certificates + +series: bionic +services: + cinder: + charm: cs:~openstack-charmers-next/cinder + num_units: 1 + options: + block-device: None + glance-api-version: 2 + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + token-provider: 'fernet' + mysql: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + constraints: mem=3072M + options: + innodb-buffer-pool-size: 256M + max-connections: 1000 + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + flat-network-providers: physnet1 + neutron-security-groups: true + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + bridge-mappings: physnet1:br-ex + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + num_units: 0 + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + network-manager: Neutron + nova-compute: + charm: cs:~openstack-charmers-next/nova-compute + num_units: 2 + options: + config-flags: default_ephemeral_format=ext4 + enable-live-migration: true + enable-resize: true + migration-auth-type: ssh + ntp: + charm: cs:ntp + num_units: 0 + openstack-dashboard: + charm: cs:~openstack-charmers-next/openstack-dashboard + num_units: 1 + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + vault: + num_units: 1 + charm: cs:~openstack-charmers-next/vault + keystone-saml-mellon: + series: bionic + charm: ../../../keystone-saml-mellon + num_units: 0 + options: + idp-name: 'samltest' + protocol-name: 'mapped' + user-facing-name: "samltest.id" + subject-confirmation-data-address-check: False + nameid-formats: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" diff --git a/src/tests/bundles/overlays/bionic-queens-ha.yaml.j2 b/src/tests/bundles/overlays/bionic-queens-ha.yaml.j2 new file mode 120000 index 0000000..9280f58 --- /dev/null +++ b/src/tests/bundles/overlays/bionic-queens-ha.yaml.j2 @@ -0,0 +1 @@ +ha.yaml.j2 \ No newline at end of file diff --git a/src/tests/bundles/overlays/bionic-queens-smoke-ha.yaml.j2 b/src/tests/bundles/overlays/bionic-queens-smoke-ha.yaml.j2 new file mode 120000 index 0000000..9280f58 --- /dev/null +++ b/src/tests/bundles/overlays/bionic-queens-smoke-ha.yaml.j2 @@ -0,0 +1 @@ +ha.yaml.j2 \ No newline at end of file diff --git a/src/tests/bundles/overlays/ha.yaml.j2 b/src/tests/bundles/overlays/ha.yaml.j2 new file mode 100644 index 0000000..754b687 --- /dev/null +++ b/src/tests/bundles/overlays/ha.yaml.j2 @@ -0,0 +1,26 @@ +relations: +- - keystone + - keystone-hacluster +- - openstack-dashboard + - openstack-dashboard-hacluster +applications: + keystone: + num_units: 3 + options: + vip: {{ OS_VIP00 }} + openstack-dashboard: + num_units: 3 + options: + vip: {{ OS_VIP01 }} + keystone-hacluster: + charm: cs:~openstack-charmers-next/hacluster + num_units: 0 + options: + corosync_transport: unicast + cluster_count: 3 + openstack-dashboard-hacluster: + charm: cs:~openstack-charmers-next/hacluster + num_units: 0 + options: + corosync_transport: unicast + cluster_count: 3 diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml new file mode 100644 index 0000000..dd62de1 --- /dev/null +++ b/src/tests/tests.yaml @@ -0,0 +1,22 @@ +charm_name: keystone-saml-mellon +smoke_bundles: +- bionic-queens-smoke +gate_bundles: +- bionic-queens +- bionic-queens-ha +configure: +- zaza.charm_tests.vault.setup.auto_inititialize +- zaza.charm_tests.keystone.setup.add_demo_user +- zaza.charm_tests.glance.setup.add_lts_image +tests: +- zaza.charm_tests.keystone.tests.AuthenticationAuthorizationTest +target_deploy_status: + ntp: + workload-status: active + workload-status-message: "chrony: Ready" + vault: + workload-status: blocked + workload-status-message: Vault needs to be initialized + keystone-saml-mellon: + workload-status: blocked + workload-status-message: "Configuration is incomplete. idp-metadata: idp-metadata resource is not a well-formed xml file" diff --git a/src/tox.ini b/src/tox.ini index f201a20..86af543 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -1,53 +1,77 @@ -# Source charm: ./src/tox.ini +# Classic charm: ./tox.ini # This file is managed centrally by release-tools and should not be modified # within individual charm repos. [tox] -envlist = pep8 +envlist = pep8,py27,py35,py36 skipsdist = True +skip_missing_interpreters = True [testenv] setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 - AMULET_SETUP_TIMEOUT=2700 -whitelist_externals = juju -passenv = HOME TERM AMULET_* CS_API_* -deps = -r{toxinidir}/test-requirements.txt + CHARM_DIR={envdir} + AMULET_SETUP_TIMEOUT=5400 install_command = - pip install --allow-unverified python-apt {opts} {packages} + pip install {opts} {packages} +commands = ostestr {posargs} +whitelist_externals = juju +passenv = HOME TERM AMULET_* CS_API_* JUJU_MODEL OS_* +deps = -r{toxinidir}/test-requirements.txt + +[testenv:py27] +basepython = python2.7 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = /bin/true + +[testenv:py35] +basepython = python3.5 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +[testenv:py36] +basepython = python3.6 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt [testenv:pep8] -basepython = python2.7 -commands = charm-proof - -[testenv:func27-noop] -# DRY RUN - For Debug -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" -n --no-destroy - -[testenv:func27] -# Run all gate tests which are +x (expected to always pass) -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" --no-destroy - -[testenv:func27-smoke] -# Run a specific test as an Amulet smoke test (expected to always pass) -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json gate-basic-xenial-pike --no-destroy - -[testenv:func27-dfs] -# Run all deploy-from-source tests which are +x (may not always pass!) -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dfs-*" --no-destroy - -[testenv:func27-dev] -# Run all development test targets which are +x (may not always pass!) -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dev-*" --no-destroy +basepython = python3 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = flake8 {posargs} hooks unit_tests tests actions lib + charm-proof [testenv:venv] +basepython = python3 commands = {posargs} + +[testenv:func] +basepython = python3 +commands = + functest-run-suite --keep-model + +[testenv:func-smoke] +basepython = python3 +commands = + functest-run-suite --keep-model --smoke + +[testenv:func-configure] +basepython = python3 +commands = + functest-configure -m +#{env:JUJU_MODEL} + +[testenv:func-test] +basepython = python3 +commands = + functest-test -m +#{env:JUJU_MODEL} + +[testenv:func-dev] +basepython = python3 +commands = + functest-run-suite --keep-model --dev + +[flake8] +ignore = E402,E226 +exclude = */charmhelpers