From df7e8ddbae0b9f216f7a51a614da764882327aa1 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Thu, 20 Oct 2022 11:20:59 +0000 Subject: [PATCH] Add functional tests Change-Id: I60b82f9c09f9d5b3c7b4caf3c0a7184989a206a7 --- .gitignore | 1 + .zuul.yaml | 3 + osci.yaml | 2 - test-requirements.txt | 4 ++ tests/bundles/xena.yaml | 133 ++++++++++++++++++++++++++++++++++++++++ tests/tests.yaml | 70 +++++++++++++++++++++ tox.ini | 28 +++++++++ 7 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 tests/bundles/xena.yaml create mode 100644 tests/tests.yaml diff --git a/.gitignore b/.gitignore index de9170b..73f116c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ __pycache__/ *.py[cod] .tox .stestr/ +tempest.log diff --git a/.zuul.yaml b/.zuul.yaml index 7ffc71c..9f317cc 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -2,3 +2,6 @@ templates: - openstack-python3-charm-yoga-jobs - openstack-cover-jobs + - microk8s-func-test + vars: + charm_build_name: ovn-central-k8s diff --git a/osci.yaml b/osci.yaml index 09d05e3..6d7642c 100644 --- a/osci.yaml +++ b/osci.yaml @@ -1,7 +1,5 @@ - project: templates: - - charm-unit-jobs-py38 - - charm-unit-jobs-py310 - charm-publish-jobs vars: needs_charm_build: true diff --git a/test-requirements.txt b/test-requirements.txt index 35f58ad..8febe61 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,3 +8,7 @@ coverage mock flake8 stestr +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://opendev.org/openstack/tempest.git#egg=tempest +ops diff --git a/tests/bundles/xena.yaml b/tests/bundles/xena.yaml new file mode 100644 index 0000000..3faed30 --- /dev/null +++ b/tests/bundles/xena.yaml @@ -0,0 +1,133 @@ +bundle: kubernetes + +applications: + traefik: + charm: ch:traefik-k8s + channel: edge + scale: 1 + trust: true + traefik-public: + charm: ch:traefik-k8s + channel: edge + scale: 1 + trust: true + options: + kubernetes-service-annotations: metallb.universe.tf/address-pool=public + mysql: + charm: ch:mysql-k8s + channel: edge + scale: 1 + trust: false + rabbitmq: + charm: ch:sunbeam-rabbitmq-operator + channel: edge + scale: 1 + trust: true + keystone: + charm: ch:keystone-k8s + channel: edge + scale: 1 + trust: true + options: + admin-role: admin + storage: + fernet-keys: 5M + credential-keys: 5M + glance: + charm: ch:glance-k8s + channel: edge + scale: 1 + trust: true + storage: + local-repository: 5G + nova: + charm: ch:nova-k8s + channel: edge + scale: 1 + trust: true + placement: + charm: ch:placement-k8s + channel: edge + scale: 1 + trust: true + neutron: + charm: ch:neutron-k8s + channel: edge + scale: 1 + trust: true + ovn-central: + charm: ch:ovn-central-k8s + charm: ../../ovn-central-k8s.charm + scale: 1 + trust: true + resources: + ovn-sb-db-server-image: kolla/ubuntu-binary-ovn-sb-db-server:xena + ovn-nb-db-server-image: kolla/ubuntu-binary-ovn-nb-db-server:xena + ovn-northd-image: kolla/ubuntu-binary-ovn-northd:xena + vault: + charm: ch:icey-vault-k8s + channel: stable + scale: 1 + resources: + vault-image: vault + +relations: +- - mysql:database + - keystone:database +- - traefik:ingress + - keystone:ingress-internal +- - traefik-public:ingress + - keystone:ingress-public + +- - mysql:database + - glance:database +- - rabbitmq:amqp + - glance:amqp +- - keystone:identity-service + - glance:identity-service +- - traefik:ingress + - glance:ingress-internal +- - traefik-public:ingress + - glance:ingress-public + +- - mysql:database + - nova:database +- - mysql:database + - nova:api-database +- - mysql:database + - nova:cell-database +- - rabbitmq:amqp + - nova:amqp +- - keystone:identity-service + - nova:identity-service +- - traefik:ingress + - nova:ingress-internal +- - traefik-public:ingress + - nova:ingress-public + +- - mysql:database + - placement:database +- - keystone:identity-service + - placement:identity-service +- - traefik:ingress + - placement:ingress-internal +- - traefik-public:ingress + - placement:ingress-public + +- - mysql:database + - neutron:database +- - rabbitmq:amqp + - neutron:amqp +- - keystone:identity-service + - neutron:identity-service +- - traefik:ingress + - neutron:ingress-internal +- - traefik-public:ingress + - neutron:ingress-public +- - vault:insecure-certificates + - neutron:certificates +- - neutron:ovsdb-cms + - ovn-central:ovsdb-cms + +- - vault:insecure-certificates + - ovn-central:certificates diff --git a/tests/tests.yaml b/tests/tests.yaml new file mode 100644 index 0000000..a8f3cca --- /dev/null +++ b/tests/tests.yaml @@ -0,0 +1,70 @@ +gate_bundles: + - xena +smoke_bundles: + - xena +configure: + - zaza.openstack.charm_tests.keystone.setup.wait_for_all_endpoints + - zaza.openstack.charm_tests.keystone.setup.add_tempest_roles + - zaza.openstack.charm_tests.nova.setup.create_flavors + - zaza.openstack.charm_tests.nova.setup.manage_ssh_key +# - zaza.openstack.charm_tests.glance.setup.add_lts_image +# - zaza.openstack.charm_tests.glance.setup.add_cirros_image +# - zaza.openstack.charm_tests.glance.setup.add_cirros_alt_image +tests: + - zaza.openstack.charm_tests.tempest.tests.TempestTestWithKeystoneMinimal +tests_options: + trust: + - xena + ignore_hard_deploy_errors: + - xena + + tempest: + default: + smoke: True + exclude-list: + - "tempest.api.image.v2.test_images.BasicOperationsImagesTest.test_register_upload_get_image_file" + - "tempest.api.compute.security_groups.test_security_group_rules.SecurityGroupRulesTestJSON.test_security_group_rules_create" + - "tempest.api.compute.security_groups.test_security_group_rules.SecurityGroupRulesTestJSON.test_security_group_rules_list" + - "tempest.api.compute.security_groups.test_security_groups.SecurityGroupsTestJSON.test_security_groups_create_list_delete" + - "tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON" + - "tempest.api.compute.servers.test_create_server.ServersTestManualDisk" + - "tempest.api.compute.servers.test_server_addresses.ServerAddressesTestJSON" + - "tempest.api.compute.servers.test_create_server.ServersTestJSON" + - "tempest.scenario.test_server_multinode.TestServerMultinode.test_schedule_to_all_nodes" + - "tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops" + - "tempest.api.compute.servers.test_attach_interfaces.AttachInterfacesUnderV243Test.test_add_remove_fixed_ip" + +target_deploy_status: + traefik: + workload-status: active + workload-status-message-regex: '^$' + traefik-public: + workload-status: active + workload-status-message-regex: '^$' + rabbitmq: + workload-status: active + workload-status-message-regex: '^$' + nova: + workload-status: active + workload-status-message-regex: '^$' + glance: + workload-status: active + workload-status-message-regex: '^$' + neutron: + workload-status: active + workload-status-message-regex: '^$' + ovn-central: + workload-status: active + workload-status-message-regex: '^$' + keystone: + workload-status: active + workload-status-message-regex: '^$' + mysql: + workload-status: active + workload-status-message-regex: '^$' + placement: + workload-status: active + workload-status-message-regex: '^$' + vault: + workload-status: active + workload-status-message-regex: '^$' diff --git a/tox.ini b/tox.ini index ca8b745..cfa25bf 100644 --- a/tox.ini +++ b/tox.ini @@ -83,6 +83,34 @@ commands = coverage xml -o cover/coverage.xml coverage report +[testenv:func-noop] +basepython = python3 +commands = + functest-run-suite --help + +[testenv:func] +basepython = python3 +commands = + functest-run-suite --keep-model + +[testenv:func-smoke] +basepython = python3 +setenv = + TEST_MODEL_SETTINGS = automatically-retry-hooks=true + TEST_MAX_RESOLVE_COUNT = 5 +commands = + functest-run-suite --keep-model --smoke + +[testenv:func-dev] +basepython = python3 +commands = + functest-run-suite --keep-model --dev + +[testenv:func-target] +basepython = python3 +commands = + functest-run-suite --keep-model --bundle {posargs} + [coverage:run] branch = True concurrency = multiprocessing