Add instance upgrade API test
Change-Id: Ibf713328d5495dda5bbadc10592cd11a84834647
This commit is contained in:
parent
a5183e9312
commit
f5a0e84a59
@ -5,15 +5,13 @@
|
||||
- tempest-plugin-jobs
|
||||
check:
|
||||
jobs:
|
||||
- trove-tempest-plugin:
|
||||
voting: false
|
||||
- trove-tempest-plugin
|
||||
- trove-tempest-ipv6-only:
|
||||
voting: false
|
||||
gate:
|
||||
queue: trove
|
||||
jobs:
|
||||
- trove-tempest-plugin:
|
||||
voting: false
|
||||
- trove-tempest-plugin
|
||||
- trove-tempest-ipv6-only:
|
||||
voting: false
|
||||
|
||||
|
@ -70,3 +70,10 @@ class TroveClient(rest_client.RestClient):
|
||||
self.expected_success(expected_status_code, resp.status)
|
||||
|
||||
return rest_client.ResponseBody(resp, json.loads(body))
|
||||
|
||||
def patch_resource(self, obj, id, req_body, expected_status_code=202):
|
||||
url = '/{obj}/{id}'.format(obj=obj, id=id)
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
resp, _ = self.patch(url, json.dumps(req_body), headers=headers)
|
||||
self.expected_success(expected_status_code, resp.status)
|
||||
|
48
trove_tempest_plugin/tests/api/base.py
Normal file
48
trove_tempest_plugin/tests/api/base.py
Normal file
@ -0,0 +1,48 @@
|
||||
# Copyright 2019 Catalyst Cloud Ltd.
|
||||
#
|
||||
# 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.
|
||||
import time
|
||||
|
||||
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 TestInstanceActionsBase(trove_base.BaseTroveTest):
|
||||
@decorators.idempotent_id("be6dd514-27d6-11ea-a56a-98f2b3cc23a0")
|
||||
def test_instance_upgrade(self):
|
||||
res = self.client.get_resource("instances", self.instance_id)
|
||||
datastore = res["instance"]['datastore']['type']
|
||||
version = res["instance"]['datastore']['version']
|
||||
new_version = version
|
||||
datastore = self.client.get_resource("datastores", datastore)
|
||||
for v in datastore['datastore']['versions']:
|
||||
if v['name'] != version:
|
||||
new_version = v['name']
|
||||
break
|
||||
|
||||
LOG.info('Using datastore %s for instance upgrading', new_version)
|
||||
|
||||
body = {
|
||||
"instance": {
|
||||
"datastore_version": new_version
|
||||
}
|
||||
}
|
||||
self.client.patch_resource('instances', self.instance_id, body)
|
||||
|
||||
time.sleep(3)
|
||||
self.wait_for_instance_status(self.instance_id,
|
||||
expected_status="ACTIVE")
|
18
trove_tempest_plugin/tests/api/test_instance_actions.py
Normal file
18
trove_tempest_plugin/tests/api/test_instance_actions.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright 2019 Catalyst Cloud Ltd.
|
||||
#
|
||||
# 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.api import base
|
||||
|
||||
|
||||
class TestInstanceActionsMySQL(base.TestInstanceActionsBase):
|
||||
datastore = 'mysql'
|
@ -17,15 +17,13 @@ from oslo_log import log as logging
|
||||
from oslo_utils import netutils
|
||||
from tempest.lib import decorators
|
||||
|
||||
from trove_tempest_plugin.tests import base
|
||||
from trove_tempest_plugin.tests import base as trove_base
|
||||
from trove_tempest_plugin.tests import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestMySQLInstanceBasic(base.BaseTroveTest):
|
||||
datastore = 'mysql'
|
||||
|
||||
class TestInstanceBasicMySQLBase(trove_base.BaseTroveTest):
|
||||
def _access_db(self, ip, username='test_user', password='password'):
|
||||
db_engine = utils.LocalSqlClient.init_engine(ip, username, password)
|
||||
db_client = utils.LocalSqlClient(db_engine)
|
||||
@ -41,7 +39,7 @@ class TestMySQLInstanceBasic(base.BaseTroveTest):
|
||||
res = self.client.get_resource("instances", self.instance_id)
|
||||
ips = res["instance"].get('ip', [])
|
||||
|
||||
# TODO(lxkong): IPv6 needs to be supported.
|
||||
# TODO(lxkong): IPv6 needs to be tested.
|
||||
v4_ip = None
|
||||
for ip in ips:
|
||||
if netutils.is_valid_ipv4(ip):
|
18
trove_tempest_plugin/tests/scenario/test_instance_basic.py
Normal file
18
trove_tempest_plugin/tests/scenario/test_instance_basic.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright 2019 Catalyst Cloud Ltd.
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
class TestInstanceBasicMySQL(base.TestInstanceBasicMySQLBase):
|
||||
datastore = 'mysql'
|
Loading…
Reference in New Issue
Block a user