Add tests: resize

Change-Id: I126c83d249f7f79b5983380b793ea85af9cf2409
This commit is contained in:
Lingxian Kong 2020-06-17 17:52:58 +12:00
parent fb79b00193
commit 00ddc03c54
4 changed files with 59 additions and 4 deletions

View File

@ -6,14 +6,14 @@
check: check:
jobs: jobs:
- trove-tempest-plugin: - trove-tempest-plugin:
voting: false voting: true
- trove-tempest-ipv6-only: - trove-tempest-ipv6-only:
voting: false voting: false
gate: gate:
queue: trove queue: trove
jobs: jobs:
- trove-tempest-plugin: - trove-tempest-plugin:
voting: false voting: true
- trove-tempest-ipv6-only: - trove-tempest-ipv6-only:
voting: false voting: false
@ -39,7 +39,7 @@
devstack_services: devstack_services:
tempest: true tempest: true
tls-proxy: false tls-proxy: false
tempest_test_regex: ^trove_tempest_plugin\.tests tempest_test_regex: ^trove_tempest_plugin\.tests.scenario\.test_instance_basic\.TestInstanceBasicMySQL\.test_database_access
branches: branches:
- stable/ocata - stable/ocata
- stable/pike - stable/pike
@ -98,7 +98,7 @@
s-object: true s-object: true
s-proxy: true s-proxy: true
tempest: true tempest: true
tempest_test_regex: ^trove_tempest_plugin\.tests tempest_test_regex: ^trove_tempest_plugin\.tests.scenario\.test_instance_basic\.TestInstanceBasicMySQL\.test_database_access
- job: - job:
name: trove-tempest-ipv6-only name: trove-tempest-ipv6-only

View File

@ -56,6 +56,11 @@ DatabaseGroup = [
default="d2", default="d2",
help="The Nova flavor ID used for creating database instance." help="The Nova flavor ID used for creating database instance."
), ),
cfg.StrOpt(
'resize_flavor_id',
default="d3",
help="The Nova flavor ID used for resizing database instance."
),
cfg.StrOpt( cfg.StrOpt(
'shared_network', 'shared_network',
default="private", default="private",

View File

@ -61,6 +61,7 @@ class BaseTroveTest(test.BaseTestCase):
cls.client = cls.os_primary.database.TroveClient() cls.client = cls.os_primary.database.TroveClient()
cls.admin_client = cls.os_admin.database.TroveClient() cls.admin_client = cls.os_admin.database.TroveClient()
cls.admin_server_client = cls.os_admin.servers_client
@classmethod @classmethod
def setup_credentials(cls): def setup_credentials(cls):

View File

@ -97,3 +97,52 @@ class TestInstanceActionsBase(trove_base.BaseTroveTest):
self.wait_for_instance_status(instance['id'], self.wait_for_instance_status(instance['id'],
expected_status="DELETED", expected_status="DELETED",
need_delete=True) need_delete=True)
@decorators.idempotent_id("27914e82-b061-11ea-b87c-00224d6b7bc1")
def test_resize(self):
# Resize flavor
LOG.info(f"Resizing flavor to {CONF.database.resize_flavor_id} for "
f"instance {self.instance_id}")
resize_flavor = {
"resize": {
"flavorRef": CONF.database.resize_flavor_id
}
}
self.client.create_resource(f"instances/{self.instance_id}/action",
resize_flavor, expected_status_code=202,
need_response=False)
self.wait_for_instance_status(self.instance_id)
# Verify Trove flavor
ret = self.client.get_resource('instances', self.instance_id)
self.assertEqual(CONF.database.resize_flavor_id,
ret['instance']['flavor']['id'])
# Verify Nova flavor
params = {
'all_tenants': True,
'detail': True,
'name': self.instance['name']
}
servers = self.admin_server_client.list_servers(**params)['servers']
self.assertEqual(1, len(servers))
self.assertEqual(CONF.database.resize_flavor_id,
servers[0]['flavor']['id'])
# Resize volume
LOG.info(f"Resizing volume to 2 for instance {self.instance_id}")
resize_volume = {
"resize": {
"volume": {
"size": 2
}
}
}
self.client.create_resource(f"instances/{self.instance_id}/action",
resize_volume, expected_status_code=202,
need_response=False)
self.wait_for_instance_status(self.instance_id)
# Verify Trove volume
ret = self.client.get_resource('instances', self.instance_id)
self.assertEqual(2, ret['instance']['volume']['size'])