Update access test

Change-Id: Ie9ff65a67bbc77c2313f3d25d9521f60286c6f96
This commit is contained in:
Lingxian Kong 2020-09-22 21:19:25 +12:00
parent fa57416207
commit 2581bc079a
2 changed files with 43 additions and 0 deletions

View File

@ -129,6 +129,41 @@ class TestInstanceBasicBase(trove_base.BaseTroveTest):
self.assertNotEqual(value, cur_value) self.assertNotEqual(value, cur_value)
self.assertNotEqual(new_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): class TestInstanceBasicMySQLBase(TestInstanceBasicBase):
def _access_db(self, ip, username=constants.DB_USER, def _access_db(self, ip, username=constants.DB_USER,
@ -281,3 +316,7 @@ class TestInstanceBasicMySQLBase(TestInstanceBasicBase):
create_values = {"max_connections": 555} create_values = {"max_connections": 555}
update_values = {"max_connections": 666} update_values = {"max_connections": 666}
self.configuration_test(create_values, update_values) self.configuration_test(create_values, update_values)
@decorators.idempotent_id("67e57c26-fcb3-11ea-a950-00224d6b7bc1")
def test_update_access(self):
self.update_access_test()

View File

@ -51,3 +51,7 @@ class TestInstanceBasicPostgreSQL(base_basic.TestInstanceBasicBase):
update_values = {"max_connections": 102} update_values = {"max_connections": 102}
self.configuration_test(create_values, update_values, self.configuration_test(create_values, update_values,
need_restart=True) need_restart=True)
@decorators.idempotent_id("5718abf6-fcb4-11ea-a950-00224d6b7bc1")
def test_update_access(self):
self.update_access_test()