Fix tests for Ubuntu Bionic migration of CI jobs

Change-Id: I2fee668c3774f7e87ce3478ca998f8b366c6cd41
This commit is contained in:
Lingxian Kong 2019-03-27 21:57:27 +13:00
parent c590106f79
commit 6ea816312e
9 changed files with 50 additions and 23 deletions

View File

@ -31,7 +31,7 @@ TROVE_LOCAL_API_PASTE_INI=${TROVE_LOCAL_API_PASTE_INI:-${TROVE_LOCAL_CONF_DIR}/a
TROVE_LOCAL_POLICY_JSON=${TROVE_LOCAL_POLICY_JSON:-${TROVE_LOCAL_CONF_DIR}/policy.json}
TROVE_DATASTORE_TYPE=${TROVE_DATASTORE_TYPE:-"mysql"}
if [ "$DISTRO" == "xenial" ]; then
if [[ "$DISTRO" == "xenial" || "$DISTRO" == "bionic" ]]; then
TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.7"}
TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"mysql-server-5.7"}
else

View File

@ -97,6 +97,7 @@
"dbaas_datastore": "%datastore_type%",
"dbaas_datastore_version": "%datastore_version%",
"neutron_enabled": %neutron_enabled%,
"swift_enabled": %swift_enabled%,
"shared_network": "%shared_network%",
"shared_network_subnet": "%shared_network_subnet%",
"instance_fault_1_flavor_name": "test.fault_1-1",

View File

@ -537,7 +537,7 @@ function set_mysql_pkg() {
MYSQL_PKG="mysql-community-server"
MYSQL_VER="5.6"
else
if [ "$RELEASE" == "xenial" ]; then
if [[ "$RELEASE" == "xenial" || "$RELEASE" == "bionic" ]]; then
MYSQL_PKG="mysql-server-5.7"
MYSQL_VER="5.7"
else
@ -734,6 +734,9 @@ function mod_confs() {
# Enable neutron tests if needed
sed -i "s/%neutron_enabled%/$ENABLE_NEUTRON/g" $TEST_CONF
# Enable backup related tests if Swift is enabled
sed -i "s/%swift_enabled%/$ENABLE_SWIFT/g" $TEST_CONF
# If neutron is enabled, the devstack plugin will have created an alt_demo
# network - write this info to the confs so that the integration tests can
# use it.

View File

@ -13,6 +13,9 @@ REGION_NAME=${REGION_NAME:-${OS_REGION_NAME:-RegionOne}}
# Enable Neutron
ENABLE_NEUTRON=$(get_bool ENABLE_NEUTRON true)
# Enable Swift
ENABLE_SWIFT=$(get_bool ENABLE_SWIFT true)
# Enable osprofiler - note: Enables Ceilometer as well
ENABLE_PROFILER=$(get_bool ENABLE_PROFILER false)
PROFILER_TRACE_SQL=$(get_bool PROFILER_TRACE_SQL false)

View File

@ -52,7 +52,8 @@ backup_count_for_instance_prior_to_create = 0
@test(depends_on_classes=[WaitForGuestInstallationToFinish],
groups=[GROUP, tests.INSTANCES])
groups=[GROUP, tests.INSTANCES],
enabled=CONFIG.swift_enabled)
class CreateBackups(object):
@test
@ -142,7 +143,8 @@ class BackupRestoreMixin(object):
@test(runs_after=[CreateBackups],
groups=[GROUP, tests.INSTANCES])
groups=[GROUP, tests.INSTANCES],
enabled=CONFIG.swift_enabled)
class WaitForBackupCreateToFinish(BackupRestoreMixin):
"""
Wait until the backup create is finished.
@ -156,7 +158,8 @@ class WaitForBackupCreateToFinish(BackupRestoreMixin):
@test(depends_on=[WaitForBackupCreateToFinish],
groups=[GROUP, tests.INSTANCES])
groups=[GROUP, tests.INSTANCES],
enabled=CONFIG.swift_enabled)
class ListBackups(object):
@test
@ -244,7 +247,8 @@ class ListBackups(object):
@test(runs_after=[ListBackups],
depends_on=[WaitForBackupCreateToFinish],
groups=[GROUP, tests.INSTANCES])
groups=[GROUP, tests.INSTANCES],
enabled=CONFIG.swift_enabled)
class IncrementalBackups(BackupRestoreMixin):
@test
@ -271,7 +275,7 @@ class IncrementalBackups(BackupRestoreMixin):
assert_equal(backup_info.id, incremental_info.parent_id)
@test(groups=[GROUP, tests.INSTANCES])
@test(groups=[GROUP, tests.INSTANCES], enabled=CONFIG.swift_enabled)
class RestoreUsingBackup(object):
@classmethod
@ -297,7 +301,8 @@ class RestoreUsingBackup(object):
@test(depends_on_classes=[WaitForGuestInstallationToFinish],
runs_after_groups=['dbaas.api.configurations.define'],
groups=[GROUP, tests.INSTANCES])
groups=[GROUP, tests.INSTANCES],
enabled=CONFIG.swift_enabled)
class WaitForRestoreToFinish(object):
@classmethod
@ -330,7 +335,7 @@ class WaitForRestoreToFinish(object):
fail('Timed out')
@test(enabled=(not CONFIG.fake_mode),
@test(enabled=(not CONFIG.fake_mode and CONFIG.swift_enabled),
groups=[GROUP, tests.INSTANCES])
class VerifyRestore(object):
@ -356,7 +361,7 @@ class VerifyRestore(object):
fail('Timed out')
@test(groups=[GROUP, tests.INSTANCES])
@test(groups=[GROUP, tests.INSTANCES], enabled=CONFIG.swift_enabled)
class DeleteRestoreInstance(object):
@classmethod
@ -385,7 +390,8 @@ class DeleteRestoreInstance(object):
@test(runs_after=[DeleteRestoreInstance],
groups=[GROUP, tests.INSTANCES])
groups=[GROUP, tests.INSTANCES],
enabled=CONFIG.swift_enabled)
class DeleteBackups(object):
@test
@ -432,7 +438,8 @@ class DeleteBackups(object):
@test(depends_on=[WaitForGuestInstallationToFinish],
runs_after=[DeleteBackups])
runs_after=[DeleteBackups],
enabled=CONFIG.swift_enabled)
class FakeTestHugeBackupOnSmallInstance(BackupRestoreMixin):
report = CONFIG.get_report()

View File

@ -37,6 +37,7 @@ from proboscis import test
import six
from troveclient.compat import exceptions
from trove.common import cfg
from trove.common import exception as rd_exceptions
from trove.common.utils import poll_until
from trove.datastore import models as datastore_models
@ -53,6 +54,8 @@ from trove.tests.util import test_config
from trove.tests.util.usage import create_usage_verifier
from trove.tests.util.users import Requirements
CONF = cfg.CONF
FAKE = test_config.values['fake_mode']
GROUP = "dbaas.guest"
@ -972,7 +975,9 @@ class SecurityGroupsTest(object):
def setUp(self):
self.testSecurityGroup = dbaas.security_groups.get(
instance_info.id)
self.secGroupName = "SecGroup_%s" % instance_info.id
self.secGroupName = (
"%s_%s" % (CONF.trove_security_group_name_prefix, instance_info.id)
)
self.secGroupDescription = "Security Group for %s" % instance_info.id
@test
@ -1018,7 +1023,9 @@ class SecurityGroupsRulesTest(object):
def setUp(self):
self.testSecurityGroup = dbaas.security_groups.get(
instance_info.id)
self.secGroupName = "SecGroup_%s" % instance_info.id
self.secGroupName = (
"%s_%s" % (CONF.trove_security_group_name_prefix, instance_info.id)
)
self.secGroupDescription = "Security Group for %s" % instance_info.id
self.orig_allowable_empty_sleeps = (event_simulator.
allowable_empty_sleeps)

View File

@ -68,8 +68,8 @@ class MgmtDataStoreVersion(object):
def test_mgmt_ds_version_list_original_count(self):
"""Tests the mgmt datastore version list method."""
self.ds_versions = self.client.mgmt_datastore_versions.list()
# By default we create two datastore-versions for mysql
assert_equal(2, len(self.ds_versions))
# datastore-versions should exist for a functional Trove deployment.
assert_true(len(self.ds_versions) > 0)
@test(depends_on=[test_mgmt_ds_version_list_original_count])
def test_mgmt_ds_version_list_fields_present(self):

View File

@ -120,7 +120,8 @@ def validate_master(master, slaves):
@test(depends_on_classes=[WaitForGuestInstallationToFinish],
groups=[GROUP])
groups=[GROUP],
enabled=CONFIG.swift_enabled)
class CreateReplicationSlave(object):
@test
@ -152,7 +153,7 @@ class CreateReplicationSlave(object):
slave_instance.id = create_slave()
@test(groups=[GROUP])
@test(groups=[GROUP], enabled=CONFIG.swift_enabled)
class WaitForCreateSlaveToFinish(object):
"""Wait until the instance is created and set up as slave."""
@ -162,7 +163,7 @@ class WaitForCreateSlaveToFinish(object):
poll_until(lambda: instance_is_active(slave_instance.id))
@test(enabled=(not CONFIG.fake_mode),
@test(enabled=(not CONFIG.fake_mode and CONFIG.swift_enabled),
depends_on=[WaitForCreateSlaveToFinish],
groups=[GROUP])
class VerifySlave(object):
@ -217,7 +218,8 @@ class VerifySlave(object):
@test(groups=[GROUP],
depends_on=[WaitForCreateSlaveToFinish],
runs_after=[VerifySlave])
runs_after=[VerifySlave],
enabled=CONFIG.swift_enabled)
class TestInstanceListing(object):
"""Test replication information in instance listing."""
@ -232,7 +234,8 @@ class TestInstanceListing(object):
@test(groups=[GROUP],
depends_on=[WaitForCreateSlaveToFinish],
runs_after=[TestInstanceListing])
runs_after=[TestInstanceListing],
enabled=CONFIG.swift_enabled)
class TestReplicationFailover(object):
"""Test replication failover functionality."""
@ -332,7 +335,8 @@ class TestReplicationFailover(object):
@test(groups=[GROUP],
depends_on=[WaitForCreateSlaveToFinish],
runs_after=[TestReplicationFailover])
runs_after=[TestReplicationFailover],
enabled=CONFIG.swift_enabled)
class DetachReplica(object):
@test
@ -370,7 +374,8 @@ class DetachReplica(object):
@test(groups=[GROUP],
depends_on=[WaitForCreateSlaveToFinish],
runs_after=[DetachReplica])
runs_after=[DetachReplica],
enabled=CONFIG.swift_enabled)
class DeleteSlaveInstance(object):
@test

View File

@ -123,6 +123,7 @@ class TestConfig(object):
"volume_support": True,
},
"redis": {"volume_support": False},
"swift_enabled": True,
}
self._frozen_values = FrozenDict(self._values)
self._users = None