diff --git a/.zuul.yaml b/.zuul.yaml index c0ba067..e9eb1ad 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -51,7 +51,7 @@ - job: name: trove-tempest-plugin parent: devstack-tempest - timeout: 7800 + timeout: 10800 description: | This job is for testing on py3 which is Ussuri onwards. required-projects: &base_required_projects @@ -98,7 +98,8 @@ s-object: true s-proxy: true tempest: true - tempest_test_regex: ^trove_tempest_plugin\.tests.scenario\.test_instance_basic\.TestInstanceBasicMySQL\.test_database_access + tempest_test_regex: ^trove_tempest_plugin\.tests + tempest_test_blacklist: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/trove-tempest-plugin"].src_dir }}/tempest_blacklist.txt' - job: name: trove-tempest-ipv6-only diff --git a/tempest_blacklist.txt b/tempest_blacklist.txt new file mode 100644 index 0000000..466e85e --- /dev/null +++ b/tempest_blacklist.txt @@ -0,0 +1,5 @@ +# --blacklist-file contents for the trove tempest job defined in .zuul.yaml + +# TODO: Need to figure out why those tests are failed in CI devstack. +^trove_tempest_plugin.tests.scenario.test_backup +^trove_tempest_plugin.tests.scenario.test_replication \ No newline at end of file diff --git a/trove_tempest_plugin/tests/scenario/base_basic.py b/trove_tempest_plugin/tests/scenario/base_basic.py index 6bdac48..04eeb3e 100644 --- a/trove_tempest_plugin/tests/scenario/base_basic.py +++ b/trove_tempest_plugin/tests/scenario/base_basic.py @@ -129,41 +129,6 @@ class TestInstanceBasicBase(trove_base.BaseTroveTest): self.assertNotEqual(value, cur_value) self.assertNotEqual(new_value, cur_value) - def update_access_test(self): - """Test update instance accessbility""" - if 'access' not in self.instance: - raise self.skipException("Access not supported in API.") - - # Change instance to be private - LOG.info(f"Changing instance {self.instance_id} to be private") - body = { - "instance": { - "access": { - "is_public": False, - } - } - } - self.client.put_resource(f'instances/{self.instance_id}', body) - self.wait_for_instance_status(self.instance_id, timeout=30) - - instance = self.client.get_resource( - "instances", self.instance_id)['instance'] - self.assertFalse(instance['access']['is_public']) - types = [addr['type'] for addr in instance['addresses']] - self.assertNotIn('public', types) - - # Change back to public - LOG.info(f"Changing instance {self.instance_id} to be public") - body = { - "instance": { - "access": { - "is_public": True, - } - } - } - self.client.put_resource(f'instances/{self.instance_id}', body) - self.wait_for_instance_status(self.instance_id, timeout=30) - class TestInstanceBasicMySQLBase(TestInstanceBasicBase): def _access_db(self, ip, username=constants.DB_USER, @@ -316,7 +281,3 @@ class TestInstanceBasicMySQLBase(TestInstanceBasicBase): create_values = {"max_connections": 555} update_values = {"max_connections": 666} self.configuration_test(create_values, update_values) - - @decorators.idempotent_id("67e57c26-fcb3-11ea-a950-00224d6b7bc1") - def test_update_access(self): - self.update_access_test() diff --git a/trove_tempest_plugin/tests/scenario/base_update_access.py b/trove_tempest_plugin/tests/scenario/base_update_access.py new file mode 100644 index 0000000..665714b --- /dev/null +++ b/trove_tempest_plugin/tests/scenario/base_update_access.py @@ -0,0 +1,66 @@ +# Copyright 2020 Catalyst Cloud +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from oslo_log import log as logging +from tempest.lib import decorators + +from trove_tempest_plugin.tests import base as trove_base + +LOG = logging.getLogger(__name__) + + +class TestInstanceUpdateAccessBase(trove_base.BaseTroveTest): + """Update instance access base class. + + Updating instance access needs to change the public IP address of the + instance, so we need a separate test class for this. + """ + def update_access_test(self): + """Test update instance accessbility""" + if 'access' not in self.instance: + raise self.skipException("Access not supported in API.") + + # Change instance to be private + LOG.info(f"Changing instance {self.instance_id} to be private") + body = { + "instance": { + "access": { + "is_public": False, + } + } + } + self.client.put_resource(f'instances/{self.instance_id}', body) + self.wait_for_instance_status(self.instance_id, timeout=30) + + instance = self.client.get_resource( + "instances", self.instance_id)['instance'] + self.assertFalse(instance['access']['is_public']) + types = [addr['type'] for addr in instance['addresses']] + self.assertNotIn('public', types) + + # Change back to public + LOG.info(f"Changing instance {self.instance_id} to be public") + body = { + "instance": { + "access": { + "is_public": True, + } + } + } + self.client.put_resource(f'instances/{self.instance_id}', body) + self.wait_for_instance_status(self.instance_id, timeout=30) + + @decorators.idempotent_id("c907cc80-36b4-11eb-b177-00224d6b7bc1") + def test_instance_update_access(self): + self.update_access_test() diff --git a/trove_tempest_plugin/tests/scenario/test_instance_basic.py b/trove_tempest_plugin/tests/scenario/test_instance_basic.py index b2f83f7..8028a97 100644 --- a/trove_tempest_plugin/tests/scenario/test_instance_basic.py +++ b/trove_tempest_plugin/tests/scenario/test_instance_basic.py @@ -51,7 +51,3 @@ class TestInstanceBasicPostgreSQL(base_basic.TestInstanceBasicBase): update_values = {"max_connections": 102} self.configuration_test(create_values, update_values, need_restart=True) - - @decorators.idempotent_id("5718abf6-fcb4-11ea-a950-00224d6b7bc1") - def test_update_access(self): - self.update_access_test() diff --git a/trove_tempest_plugin/tests/scenario/test_instance_update_access.py b/trove_tempest_plugin/tests/scenario/test_instance_update_access.py new file mode 100644 index 0000000..badf50e --- /dev/null +++ b/trove_tempest_plugin/tests/scenario/test_instance_update_access.py @@ -0,0 +1,27 @@ +# Copyright 2020 Catalyst Cloud +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from trove_tempest_plugin.tests.scenario import base_update_access as base + + +class TestInstanceUpdateAccessMySQL(base.TestInstanceUpdateAccessBase): + datastore = 'mysql' + + +class TestInstanceUpdateAccessMariaDB(base.TestInstanceUpdateAccessBase): + datastore = 'mariadb' + + +class TestInstanceUpdateAccessPostgreSQL(base.TestInstanceUpdateAccessBase): + datastore = 'postgresql'