Fix config parameters test for fake mode

This commit makes the config parameters tests run in fake mode.

Closes-Bug: 1370237
Change-Id: I6ce228a627b35ee418c290a9f19baa163261fb7c
This commit is contained in:
Tim Simpson 2014-09-16 15:52:51 -05:00
parent d2d648f46d
commit 108fbc5ef3
2 changed files with 36 additions and 18 deletions

View File

@ -73,24 +73,27 @@ def initialize_trove(config_file):
def datastore_init(): def datastore_init():
# Adds the datastore for mysql (needed to make most calls work). # Adds the datastore for mysql (needed to make most calls work).
from trove.datastore import models from trove.datastore import models
from trove.configuration.models import DatastoreConfigurationParameters
models.DBDatastore.create(id=CONFIG.dbaas_datastore_id, models.DBDatastore.create(id=CONFIG.dbaas_datastore_id,
name=CONFIG.dbaas_datastore, name=CONFIG.dbaas_datastore,
default_version_id= default_version_id=
CONFIG.dbaas_datastore_version_id) CONFIG.dbaas_datastore_version_id)
models.DBDatastore.create(id=CONFIG.dbaas_datastore_id_no_versions, models.DBDatastore.create(id=CONFIG.dbaas_datastore_id_no_versions,
name='Test_Datastore_1', name='Test_Datastore_1',
default_version_id=None) default_version_id=None)
models.DBDatastoreVersion.create(id=CONFIG.dbaas_datastore_version_id, main_dsv = models.DBDatastoreVersion.create(
datastore_id= id=CONFIG.dbaas_datastore_version_id,
CONFIG.dbaas_datastore_id, datastore_id=
name=CONFIG.dbaas_datastore_version, CONFIG.dbaas_datastore_id,
manager="mysql", name=CONFIG.dbaas_datastore_version,
image_id= manager="mysql",
'c00000c0-00c0-0c00-00c0-000c000000cc', image_id=
packages='test packages', 'c00000c0-00c0-0c00-00c0-000c000000cc',
active=1) packages='test packages',
active=1)
models.DBDatastoreVersion.create(id="d00000d0-00d0-0d00-00d0-000d000000dd", models.DBDatastoreVersion.create(id="d00000d0-00d0-0d00-00d0-000d000000dd",
datastore_id= datastore_id=
CONFIG.dbaas_datastore_id, CONFIG.dbaas_datastore_id,
@ -100,6 +103,25 @@ def datastore_init():
'c00000c0-00c0-0c00-00c0-000c000000cc', 'c00000c0-00c0-0c00-00c0-000c000000cc',
packages=None, active=0) packages=None, active=0)
def add_parm(name, data_type, max_size, min_size=0, restart_required=0):
DatastoreConfigurationParameters.create(
datastore_version_id=main_dsv.id,
name=name,
restart_required=restart_required,
max_size=max_size,
min_size=0,
data_type=data_type,
deleted=0,
deleted_at=None)
add_parm('key_buffer_size', 'integer', 4294967296)
add_parm('connect_timeout', 'integer', 65535)
add_parm('join_buffer_size', 'integer', 4294967296)
add_parm('local_infile', 'integer', 1)
add_parm('collation_server', 'string', None, None)
add_parm('innodb_buffer_pool_size', 'integer', 57671680,
restart_required=1)
def initialize_database(): def initialize_database():
from trove.db import get_db_api from trove.db import get_db_api
@ -172,6 +194,7 @@ if __name__ == "__main__":
from trove.tests.api import instances_delete # noqa from trove.tests.api import instances_delete # noqa
from trove.tests.api import instances_mysql_down # noqa from trove.tests.api import instances_mysql_down # noqa
from trove.tests.api import instances_resize # noqa from trove.tests.api import instances_resize # noqa
from trove.tests.api import configurations # noqa
from trove.tests.api import databases # noqa from trove.tests.api import databases # noqa
from trove.tests.api import datastores # noqa from trove.tests.api import datastores # noqa
from trove.tests.api import replication # noqa from trove.tests.api import replication # noqa

View File

@ -33,7 +33,6 @@ from trove.tests.api.instances import TIMEOUT_INSTANCE_DELETE
from trove.tests.api.instances import WaitForGuestInstallationToFinish from trove.tests.api.instances import WaitForGuestInstallationToFinish
from trove.tests.config import CONFIG from trove.tests.config import CONFIG
from trove.tests.util import create_dbaas_client from trove.tests.util import create_dbaas_client
from trove.tests.util import test_config
from trove.tests.util.check import AttrCheck from trove.tests.util.check import AttrCheck
from trove.tests.util.check import CollectionCheck from trove.tests.util.check import CollectionCheck
from trove.tests.util.check import TypeCheck from trove.tests.util.check import TypeCheck
@ -279,7 +278,8 @@ class CreateConfigurations(ConfigurationsTestBase):
expected_configs = self.expected_default_datastore_configs() expected_configs = self.expected_default_datastore_configs()
values = json.dumps(expected_configs.get('appending_values')) values = json.dumps(expected_configs.get('appending_values'))
# ensure updated timestamp is different than created # ensure updated timestamp is different than created
sleep(1) if not CONFIG.fake_mode:
sleep(1)
instance_info.dbaas.configurations.edit(configuration_info.id, instance_info.dbaas.configurations.edit(configuration_info.id,
values) values)
resp, body = instance_info.dbaas.client.last_response resp, body = instance_info.dbaas.client.last_response
@ -358,7 +358,8 @@ class AfterConfigurationsCreation(ConfigurationsTestBase):
# check that created and updated timestamps differ, since # check that created and updated timestamps differ, since
# test_appending_to_existing_configuration should have changed the # test_appending_to_existing_configuration should have changed the
# updated timestamp # updated timestamp
assert_not_equal(result.created, result.updated) if not CONFIG.fake_mode:
assert_not_equal(result.created, result.updated)
assert_equal(result.instance_count, 1) assert_equal(result.instance_count, 1)
@ -520,9 +521,6 @@ class StartInstanceWithConfiguration(ConfigurationsTestBase):
@test @test
def test_start_instance_with_configuration(self): def test_start_instance_with_configuration(self):
# test that a new instance will apply the configuration on create # test that a new instance will apply the configuration on create
if test_config.auth_strategy == "fake":
raise SkipTest("Skipping instance start with configuration "
"test for fake mode.")
global configuration_instance global configuration_instance
databases = [] databases = []
databases.append({"name": "firstdbconfig", "character_set": "latin2", databases.append({"name": "firstdbconfig", "character_set": "latin2",
@ -558,9 +556,6 @@ class WaitForConfigurationInstanceToFinish(ConfigurationsTestBase):
@time_out(TIMEOUT_INSTANCE_CREATE) @time_out(TIMEOUT_INSTANCE_CREATE)
def test_instance_with_configuration_active(self): def test_instance_with_configuration_active(self):
# wait for the instance to become active # wait for the instance to become active
if test_config.auth_strategy == "fake":
raise SkipTest("Skipping instance start with configuration "
"test for fake mode.")
def result_is_active(): def result_is_active():
instance = instance_info.dbaas.instances.get( instance = instance_info.dbaas.instances.get(