tests: remove testscenario usage for storage drivers
We test only one driver at a time, so there is no need to leverage scenarios here. Change-Id: Ieff6e52d5efe46fc7ad5fa66b3fe199b1ac8c460
This commit is contained in:
parent
867ad8d6ab
commit
656da0a6c9
@ -26,7 +26,6 @@ from oslotest import mockpatch
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
import sqlalchemy
|
||||
import testscenarios.testcase
|
||||
from testtools import testcase
|
||||
|
||||
from ceilometer import storage
|
||||
@ -173,7 +172,8 @@ class SQLiteManager(fixtures.Fixture):
|
||||
self.url, 'ceilometer.event.storage')
|
||||
|
||||
|
||||
class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase):
|
||||
@six.add_metaclass(test_base.SkipNotImplementedMeta)
|
||||
class TestBase(test_base.BaseTestCase):
|
||||
|
||||
DRIVER_MANAGERS = {
|
||||
'mongodb': MongoDbManager,
|
||||
@ -186,11 +186,12 @@ class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase):
|
||||
if mocks is not None:
|
||||
DRIVER_MANAGERS['hbase'] = HBaseManager
|
||||
|
||||
db_url = 'sqlite://' # NOTE(Alexei_987) Set default db url
|
||||
|
||||
def setUp(self):
|
||||
super(TestBase, self).setUp()
|
||||
engine = urlparse.urlparse(self.db_url).scheme
|
||||
db_url = os.environ.get('CEILOMETER_TEST_STORAGE_URL',
|
||||
"sqlite://")
|
||||
|
||||
engine = urlparse.urlparse(db_url).scheme
|
||||
# in case some drivers have additional specification, for example:
|
||||
# PyMySQL will have scheme mysql+pymysql
|
||||
engine = engine.split('+')[0]
|
||||
@ -205,10 +206,12 @@ class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase):
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF([], project='ceilometer', validate_default_values=True)
|
||||
|
||||
try:
|
||||
self.db_manager = self._get_driver_manager(engine)(self.db_url)
|
||||
except ValueError as exc:
|
||||
self.skipTest("missing driver manager: %s" % exc)
|
||||
manager = self.DRIVER_MANAGERS.get(engine)
|
||||
if not manager:
|
||||
self.skipTest("missing driver manager: %s" % engine)
|
||||
|
||||
self.db_manager = manager(db_url)
|
||||
|
||||
self.useFixture(self.db_manager)
|
||||
|
||||
self.conn = self.db_manager.connection
|
||||
@ -241,12 +244,6 @@ class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase):
|
||||
return self.event_conn
|
||||
return self.conn
|
||||
|
||||
def _get_driver_manager(self, engine):
|
||||
manager = self.DRIVER_MANAGERS.get(engine)
|
||||
if not manager:
|
||||
raise ValueError('No manager available for %s' % engine)
|
||||
return manager
|
||||
|
||||
|
||||
def run_with(*drivers):
|
||||
"""Used to mark tests that are only applicable for certain db driver.
|
||||
@ -267,31 +264,3 @@ def run_with(*drivers):
|
||||
test._run_with = drivers
|
||||
return test
|
||||
return decorator
|
||||
|
||||
|
||||
@six.add_metaclass(test_base.SkipNotImplementedMeta)
|
||||
class MixinTestsWithBackendScenarios(object):
|
||||
|
||||
scenarios = [
|
||||
('sqlite', {'db_url': 'sqlite://'}),
|
||||
]
|
||||
|
||||
for db in ('MONGODB', 'MYSQL', 'PGSQL', 'HBASE', 'DB2', 'ES'):
|
||||
if os.environ.get('CEILOMETER_TEST_%s_URL' % db):
|
||||
scenarios.append(
|
||||
(db.lower(), {'db_url': os.environ.get(
|
||||
'CEILOMETER_TEST_%s_URL' % db)}))
|
||||
|
||||
scenarios_db = [db for db, _ in scenarios]
|
||||
|
||||
# Insert default value for hbase test
|
||||
if 'hbase' not in scenarios_db:
|
||||
scenarios.append(
|
||||
('hbase', {'db_url': 'hbase://__test__'}))
|
||||
|
||||
# Insert default value for db2 test
|
||||
if 'mongodb' in scenarios_db and 'db2' not in scenarios_db:
|
||||
scenarios.append(
|
||||
('db2', {'db_url': os.environ.get('CEILOMETER_TEST_MONGODB_URL',
|
||||
'').replace('mongodb://',
|
||||
'db2://')}))
|
||||
|
@ -27,7 +27,6 @@ import webtest
|
||||
from ceilometer.api import app
|
||||
from ceilometer.publisher import utils
|
||||
from ceilometer import sample
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional import api as acl
|
||||
from ceilometer.tests.functional.api import v2
|
||||
|
||||
@ -79,8 +78,7 @@ class FakeMemcache(object):
|
||||
pass
|
||||
|
||||
|
||||
class TestAPIACL(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestAPIACL(v2.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestAPIACL, self).setUp()
|
||||
@ -228,8 +226,7 @@ class TestAPIEventACL(TestAPIACL):
|
||||
self.assertEqual(401, data.status_int)
|
||||
|
||||
|
||||
class TestApiEventRBAC(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestApiEventRBAC(v2.FunctionalTest):
|
||||
|
||||
PATH = '/events'
|
||||
|
||||
|
@ -14,17 +14,10 @@
|
||||
# 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 testscenarios
|
||||
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional.api import v2 as tests_api
|
||||
|
||||
load_tests = testscenarios.load_tests_apply_scenarios
|
||||
|
||||
|
||||
class TestCapabilitiesController(tests_api.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestCapabilitiesController(tests_api.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestCapabilitiesController, self).setUp()
|
||||
|
@ -24,7 +24,6 @@ from oslo_utils import timeutils
|
||||
|
||||
from ceilometer.publisher import utils
|
||||
from ceilometer import sample
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional.api import v2 as tests_api
|
||||
|
||||
|
||||
@ -36,9 +35,7 @@ non_admin_header = {"X-Roles": "Member",
|
||||
"project-id1"}
|
||||
|
||||
|
||||
class TestQueryMetersController(tests_api.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class TestQueryMetersController(tests_api.FunctionalTest):
|
||||
def setUp(self):
|
||||
super(TestQueryMetersController, self).setUp()
|
||||
self.url = '/query/samples'
|
||||
|
@ -21,12 +21,10 @@ import mock
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from ceilometer.storage import models
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional.api import v2
|
||||
|
||||
|
||||
class TestComputeDurationByResource(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestComputeDurationByResource(v2.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestComputeDurationByResource, self).setUp()
|
||||
|
@ -30,8 +30,7 @@ HEADERS = {"X-Roles": "admin",
|
||||
"X-Project-Id": PROJ_ID}
|
||||
|
||||
|
||||
class EventTestBase(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class EventTestBase(v2.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(EventTestBase, self).setUp()
|
||||
@ -466,8 +465,7 @@ class TestEventAPI(EventTestBase):
|
||||
'op': 'el'}])
|
||||
|
||||
|
||||
class AclRestrictedEventTestBase(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class AclRestrictedEventTestBase(v2.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(AclRestrictedEventTestBase, self).setUp()
|
||||
@ -595,8 +593,7 @@ class AclRestrictedEventTestBase(v2.FunctionalTest,
|
||||
self.assertEqual(0, len(data))
|
||||
|
||||
|
||||
class EventRestrictionTestBase(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class EventRestrictionTestBase(v2.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(EventRestrictionTestBase, self).setUp()
|
||||
|
@ -25,20 +25,17 @@ import webtest.app
|
||||
|
||||
from ceilometer.publisher import utils
|
||||
from ceilometer import sample
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional.api import v2
|
||||
|
||||
|
||||
class TestListEmptyMeters(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestListEmptyMeters(v2.FunctionalTest):
|
||||
|
||||
def test_empty(self):
|
||||
data = self.get_json('/meters')
|
||||
self.assertEqual([], data)
|
||||
|
||||
|
||||
class TestValidateUserInput(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestValidateUserInput(v2.FunctionalTest):
|
||||
|
||||
def test_list_meters_query_float_metadata(self):
|
||||
self.assertRaises(webtest.app.AppError, self.get_json,
|
||||
@ -61,8 +58,7 @@ class TestValidateUserInput(v2.FunctionalTest,
|
||||
'type': 'integer'}])
|
||||
|
||||
|
||||
class TestListMetersRestriction(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestListMetersRestriction(v2.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestListMetersRestriction, self).setUp()
|
||||
@ -141,8 +137,7 @@ class TestListMetersRestriction(v2.FunctionalTest,
|
||||
self.assertEqual(3, len(data))
|
||||
|
||||
|
||||
class TestListMeters(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestListMeters(v2.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestListMeters, self).setUp()
|
||||
|
@ -23,12 +23,10 @@ import webtest.app
|
||||
|
||||
from ceilometer.publisher import utils
|
||||
from ceilometer import sample
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional.api import v2
|
||||
|
||||
|
||||
class TestListResources(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestListResources(v2.FunctionalTest):
|
||||
|
||||
def test_empty(self):
|
||||
data = self.get_json('/resources')
|
||||
@ -519,9 +517,7 @@ class TestListResources(v2.FunctionalTest,
|
||||
in links[0]['href'])
|
||||
|
||||
|
||||
class TestListResourcesRestriction(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class TestListResourcesRestriction(v2.FunctionalTest):
|
||||
def setUp(self):
|
||||
super(TestListResourcesRestriction, self).setUp()
|
||||
self.CONF.set_override('default_api_return_limit', 10, group='api')
|
||||
|
@ -23,12 +23,10 @@ import six
|
||||
|
||||
from ceilometer.publisher import utils
|
||||
from ceilometer import sample
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional.api import v2
|
||||
|
||||
|
||||
class TestListSamples(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestListSamples(v2.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestListSamples, self).setUp()
|
||||
|
@ -22,12 +22,10 @@ import mock
|
||||
from oslo_utils import timeutils
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional.api import v2
|
||||
|
||||
|
||||
class TestPostSamples(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestPostSamples(v2.FunctionalTest):
|
||||
def fake_notifier_sample(self, ctxt, event_type, payload):
|
||||
samples = payload['samples']
|
||||
for m in samples:
|
||||
|
@ -22,9 +22,7 @@ from ceilometer.tests import db as tests_db
|
||||
from ceilometer.tests.functional.api import v2
|
||||
|
||||
|
||||
class TestMaxProjectVolume(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class TestMaxProjectVolume(v2.FunctionalTest):
|
||||
PATH = '/meters/volume.size/statistics'
|
||||
|
||||
def setUp(self):
|
||||
@ -119,9 +117,7 @@ class TestMaxProjectVolume(v2.FunctionalTest,
|
||||
self.assertEqual(1, data[0]['count'])
|
||||
|
||||
|
||||
class TestMaxResourceVolume(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class TestMaxResourceVolume(v2.FunctionalTest):
|
||||
PATH = '/meters/volume.size/statistics'
|
||||
|
||||
def setUp(self):
|
||||
@ -248,8 +244,7 @@ class TestMaxResourceVolume(v2.FunctionalTest,
|
||||
self.assertEqual(1, data[0]['count'])
|
||||
|
||||
|
||||
class TestSumProjectVolume(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestSumProjectVolume(v2.FunctionalTest):
|
||||
|
||||
PATH = '/meters/volume.size/statistics'
|
||||
|
||||
@ -347,8 +342,7 @@ class TestSumProjectVolume(v2.FunctionalTest,
|
||||
self.assertEqual(1, data[0]['count'])
|
||||
|
||||
|
||||
class TestSumResourceVolume(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestSumResourceVolume(v2.FunctionalTest):
|
||||
|
||||
PATH = '/meters/volume.size/statistics'
|
||||
|
||||
@ -472,8 +466,7 @@ class TestSumResourceVolume(v2.FunctionalTest,
|
||||
self.assertEqual(1, data[0]['count'])
|
||||
|
||||
|
||||
class TestGroupByInstance(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestGroupByInstance(v2.FunctionalTest):
|
||||
|
||||
PATH = '/meters/instance/statistics'
|
||||
|
||||
@ -1216,8 +1209,7 @@ class TestGroupByInstance(v2.FunctionalTest,
|
||||
|
||||
|
||||
@tests_db.run_with('mongodb', 'hbase', 'db2')
|
||||
class TestGroupBySource(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestGroupBySource(v2.FunctionalTest):
|
||||
|
||||
# FIXME(terriyu): We have to put test_group_by_source in its own class
|
||||
# because SQLAlchemy currently doesn't support group by source statistics.
|
||||
@ -1319,8 +1311,7 @@ class TestGroupBySource(v2.FunctionalTest,
|
||||
self.assertEqual(4, r['avg'])
|
||||
|
||||
|
||||
class TestSelectableAggregates(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestSelectableAggregates(v2.FunctionalTest):
|
||||
|
||||
PATH = '/meters/instance/statistics'
|
||||
|
||||
@ -1561,8 +1552,7 @@ class TestSelectableAggregates(v2.FunctionalTest,
|
||||
|
||||
|
||||
@tests_db.run_with('mongodb', 'hbase', 'db2')
|
||||
class TestUnparameterizedAggregates(v2.FunctionalTest,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestUnparameterizedAggregates(v2.FunctionalTest):
|
||||
|
||||
# We put the stddev test case in a separate class so that we
|
||||
# can easily exclude the sqlalchemy scenario, as sqlite doesn't
|
||||
|
@ -24,6 +24,7 @@ import uuid
|
||||
from gabbi import fixture
|
||||
from oslo_config import fixture as fixture_config
|
||||
from oslo_policy import opts
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.event.storage import models
|
||||
from ceilometer.publisher import utils
|
||||
@ -31,11 +32,10 @@ from ceilometer import sample
|
||||
from ceilometer import service
|
||||
from ceilometer import storage
|
||||
|
||||
|
||||
# TODO(chdent): For now only MongoDB is supported, because of easy
|
||||
# database name handling and intentional focus on the API, not the
|
||||
# data store.
|
||||
ENGINES = ['MONGODB']
|
||||
ENGINES = ['mongodb']
|
||||
|
||||
|
||||
class ConfigFixture(fixture.GabbiFixture):
|
||||
@ -47,15 +47,14 @@ class ConfigFixture(fixture.GabbiFixture):
|
||||
self.conf = None
|
||||
|
||||
# Determine the database connection.
|
||||
db_url = None
|
||||
for engine in ENGINES:
|
||||
try:
|
||||
db_url = os.environ['CEILOMETER_TEST_%s_URL' % engine]
|
||||
except KeyError:
|
||||
pass
|
||||
if db_url is None:
|
||||
db_url = os.environ.get('CEILOMETER_TEST_STORAGE_URL')
|
||||
if not db_url:
|
||||
raise case.SkipTest('No database connection configured')
|
||||
|
||||
engine = urlparse.urlparse(db_url).scheme
|
||||
if engine not in ENGINES:
|
||||
raise case.SkipTest('Database engine not supported')
|
||||
|
||||
service.prepare_service(argv=[], config_files=[])
|
||||
conf = fixture_config.Config().conf
|
||||
self.conf = conf
|
||||
|
@ -26,8 +26,7 @@ from ceilometer import sample
|
||||
from ceilometer.tests import db as tests_db
|
||||
|
||||
|
||||
class TestDirectPublisher(tests_db.TestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestDirectPublisher(tests_db.TestBase):
|
||||
|
||||
resource_id = str(uuid.uuid4())
|
||||
|
||||
@ -83,9 +82,7 @@ class TestDirectPublisher(tests_db.TestBase,
|
||||
self.assertEqual(['alpha', 'beta', 'gamma'], names)
|
||||
|
||||
|
||||
class TestEventDirectPublisher(tests_db.TestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class TestEventDirectPublisher(tests_db.TestBase):
|
||||
test_data = [event.Event(message_id=str(uuid.uuid4()),
|
||||
event_type='event_%d' % i,
|
||||
generated=datetime.datetime.utcnow(),
|
||||
|
@ -35,8 +35,7 @@ from ceilometer.tests import base as test_base
|
||||
from ceilometer.tests import db as tests_db
|
||||
|
||||
|
||||
class ConnectionTest(tests_db.TestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class ConnectionTest(tests_db.TestBase):
|
||||
|
||||
@tests_db.run_with('hbase')
|
||||
def test_hbase_connection(self):
|
||||
|
@ -28,8 +28,7 @@ from ceilometer.tests import db as tests_db
|
||||
|
||||
|
||||
@tests_db.run_with('mongodb')
|
||||
class MongoDBConnection(tests_db.TestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class MongoDBConnection(tests_db.TestBase):
|
||||
def test_connection_pooling(self):
|
||||
test_conn = impl_mongodb.Connection(self.db_manager.url)
|
||||
self.assertEqual(self.conn.conn, test_conn.conn)
|
||||
@ -51,8 +50,7 @@ class MongoDBConnection(tests_db.TestBase,
|
||||
|
||||
|
||||
@tests_db.run_with('mongodb')
|
||||
class IndexTest(tests_db.TestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class IndexTest(tests_db.TestBase):
|
||||
|
||||
def _test_ttl_index_absent(self, conn, coll_name, ttl_opt):
|
||||
# create a fake index and check it is deleted
|
||||
|
@ -24,8 +24,7 @@ from ceilometer.tests.functional.storage import test_storage_scenarios
|
||||
|
||||
|
||||
@tests_db.run_with('mongodb', 'db2')
|
||||
class CompatibilityTest(test_storage_scenarios.DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class CompatibilityTest(test_storage_scenarios.DBTestBase):
|
||||
|
||||
def prepare_data(self):
|
||||
def old_record_metering_data(self, data):
|
||||
|
@ -128,8 +128,7 @@ class DBTestBase(tests_db.TestBase):
|
||||
)
|
||||
|
||||
|
||||
class ResourceTest(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class ResourceTest(DBTestBase):
|
||||
def prepare_data(self):
|
||||
super(ResourceTest, self).prepare_data()
|
||||
|
||||
@ -307,8 +306,7 @@ class ResourceTest(DBTestBase,
|
||||
self.assertEqual(expected_tag, resource.metadata['tag'])
|
||||
|
||||
|
||||
class ResourceTestOrdering(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class ResourceTestOrdering(DBTestBase):
|
||||
def prepare_data(self):
|
||||
sample_timings = [('resource-id-1', [(2013, 8, 10, 10, 43),
|
||||
(2013, 8, 10, 10, 44),
|
||||
@ -358,9 +356,7 @@ class ResourceTestOrdering(DBTestBase,
|
||||
self.assertEqual('sample-8', resource.metadata['tag'])
|
||||
|
||||
|
||||
class MeterTest(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class MeterTest(DBTestBase):
|
||||
def test_get_meters(self):
|
||||
msgs_sources = [msg['source'] for msg in self.msgs]
|
||||
results = list(self.conn.get_meters())
|
||||
@ -387,8 +383,7 @@ class MeterTest(DBTestBase,
|
||||
self.assertEqual(9, len(results))
|
||||
|
||||
|
||||
class RawSampleTest(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class RawSampleTest(DBTestBase):
|
||||
|
||||
def prepare_data(self):
|
||||
super(RawSampleTest, self).prepare_data()
|
||||
@ -678,8 +673,7 @@ class RawSampleTest(DBTestBase,
|
||||
self.assertEqual(3, retry_sleep.call_count)
|
||||
|
||||
|
||||
class ComplexSampleQueryTest(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class ComplexSampleQueryTest(DBTestBase):
|
||||
def setUp(self):
|
||||
super(ComplexSampleQueryTest, self).setUp()
|
||||
self.complex_filter = {
|
||||
@ -1079,9 +1073,7 @@ class ComplexSampleQueryTest(DBTestBase,
|
||||
[0.41, 0.8, 0.81])
|
||||
|
||||
|
||||
class StatisticsTest(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class StatisticsTest(DBTestBase):
|
||||
def prepare_data(self):
|
||||
for i in range(3):
|
||||
c = sample.Sample(
|
||||
@ -1335,9 +1327,7 @@ class StatisticsTest(DBTestBase,
|
||||
self.assertEqual([], results)
|
||||
|
||||
|
||||
class StatisticsGroupByTest(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class StatisticsGroupByTest(DBTestBase):
|
||||
def prepare_data(self):
|
||||
test_sample_data = (
|
||||
{'volume': 2, 'user': 'user-1', 'project': 'project-1',
|
||||
@ -2569,8 +2559,7 @@ class StatisticsGroupByTest(DBTestBase,
|
||||
[r.groupby, r.period_start])
|
||||
|
||||
|
||||
class CounterDataTypeTest(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class CounterDataTypeTest(DBTestBase):
|
||||
def prepare_data(self):
|
||||
c = sample.Sample(
|
||||
'dummyBigCounter',
|
||||
@ -2645,8 +2634,7 @@ class CounterDataTypeTest(DBTestBase,
|
||||
self.assertEqual(1938495037.53697, results[0].counter_volume)
|
||||
|
||||
|
||||
class EventTestBase(tests_db.TestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class EventTestBase(tests_db.TestBase):
|
||||
"""Separate test base class.
|
||||
|
||||
We don't want to inherit all the Meter stuff.
|
||||
@ -3079,8 +3067,7 @@ class GetEventTest(EventTestBase):
|
||||
options.remove((trait.dtype, trait.value))
|
||||
|
||||
|
||||
class BigIntegerTest(tests_db.TestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class BigIntegerTest(tests_db.TestBase):
|
||||
def test_metadata_bigint(self):
|
||||
metadata = {'bigint': 99999999999999}
|
||||
s = sample.Sample(name='name',
|
||||
@ -3098,9 +3085,7 @@ class BigIntegerTest(tests_db.TestBase,
|
||||
|
||||
|
||||
@tests_db.run_with('mongodb')
|
||||
class MongoAutoReconnectTest(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
class MongoAutoReconnectTest(DBTestBase):
|
||||
def setUp(self):
|
||||
super(MongoAutoReconnectTest, self).setUp()
|
||||
self.CONF.set_override('retry_interval', 0, group='database')
|
||||
@ -3172,7 +3157,7 @@ class MongoAutoReconnectTest(DBTestBase,
|
||||
|
||||
|
||||
@tests_db.run_with('mongodb')
|
||||
class MongoTimeToLiveTest(DBTestBase, tests_db.MixinTestsWithBackendScenarios):
|
||||
class MongoTimeToLiveTest(DBTestBase):
|
||||
|
||||
def test_ensure_index(self):
|
||||
cfg.CONF.set_override('metering_time_to_live', 5, group='database')
|
||||
@ -3193,8 +3178,7 @@ class MongoTimeToLiveTest(DBTestBase, tests_db.MixinTestsWithBackendScenarios):
|
||||
['meter_ttl']['expireAfterSeconds'])
|
||||
|
||||
|
||||
class TestRecordUnicodeSamples(DBTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
class TestRecordUnicodeSamples(DBTestBase):
|
||||
def prepare_data(self):
|
||||
self.msgs = []
|
||||
self.msgs.append(self.create_and_store_sample(
|
||||
|
@ -1,9 +1,5 @@
|
||||
function clean_exit(){
|
||||
local error_code="$?"
|
||||
if test -n "$CEILOMETER_TEST_HBASE_URL"
|
||||
then
|
||||
python tools/test_hbase_table_utils.py --clear
|
||||
fi
|
||||
rm -rf "$1"
|
||||
kill $(jobs -p)
|
||||
return $error_code
|
||||
|
@ -32,7 +32,7 @@ elasticsearch -p ${ES_PID} -Des.http.port=${ES_PORT} -Des.path.logs=${ES_DATA}/l
|
||||
# Wait for ElasticSearch to start listening to connections
|
||||
sleep 3
|
||||
wait_for_line "started" ${ES_DATA}/out
|
||||
export CEILOMETER_TEST_ES_URL="es://localhost:${ES_PORT}"
|
||||
export CEILOMETER_TEST_STORAGE_URL="es://localhost:${ES_PORT}"
|
||||
|
||||
# Yield execution to venv command
|
||||
$*
|
||||
|
@ -21,12 +21,7 @@ mongod --maxConns 32 --nojournal --noprealloc --smallfiles --quiet --noauth --po
|
||||
wait_for_line "waiting for connections on port ${MONGO_PORT}" ${MONGO_DATA}/out
|
||||
# Read the fifo for ever otherwise mongod would block
|
||||
cat ${MONGO_DATA}/out > /dev/null &
|
||||
export CEILOMETER_TEST_MONGODB_URL="mongodb://localhost:${MONGO_PORT}/ceilometer"
|
||||
if test -n "$CEILOMETER_TEST_HBASE_URL"
|
||||
then
|
||||
export CEILOMETER_TEST_HBASE_TABLE_PREFIX=$(hexdump -n 16 -v -e '/1 "%02X"' /dev/urandom)
|
||||
python tools/test_hbase_table_utils.py --upgrade
|
||||
fi
|
||||
export CEILOMETER_TEST_STORAGE_URL="mongodb://localhost:${MONGO_PORT}/ceilometer"
|
||||
|
||||
# Yield execution to venv command
|
||||
$*
|
||||
|
@ -22,7 +22,7 @@ mkfifo ${MYSQL_DATA}/out
|
||||
mysqld --datadir=${MYSQL_DATA} --pid-file=${MYSQL_DATA}/mysql.pid --socket=${MYSQL_DATA}/mysql.socket --skip-networking --skip-grant-tables &> ${MYSQL_DATA}/out &
|
||||
# Wait for MySQL to start listening to connections
|
||||
wait_for_line "mysqld: ready for connections." ${MYSQL_DATA}/out
|
||||
export CEILOMETER_TEST_MYSQL_URL="mysql+pymysql://root@localhost/template1?unix_socket=${MYSQL_DATA}/mysql.socket&charset=utf8"
|
||||
export CEILOMETER_TEST_STORAGE_URL="mysql+pymysql://root@localhost/template1?unix_socket=${MYSQL_DATA}/mysql.socket&charset=utf8"
|
||||
|
||||
# Yield execution to venv command
|
||||
$*
|
||||
|
@ -28,7 +28,7 @@ ${PGSQL_PATH}/initdb -E UTF8 ${PGSQL_DATA}
|
||||
trap "clean_exit_pgsql ${PGSQL_PATH} ${PGSQL_DATA} ${PGSQL_PORT}" EXIT
|
||||
|
||||
LANGUAGE=C ${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-F -k ${PGSQL_DATA} -p ${PGSQL_PORT}" start
|
||||
export CEILOMETER_TEST_PGSQL_URL="postgresql:///?host=${PGSQL_DATA}&port=${PGSQL_PORT}&dbname=template1"
|
||||
export CEILOMETER_TEST_STORAGE_URL="postgresql:///?host=${PGSQL_DATA}&port=${PGSQL_PORT}&dbname=template1"
|
||||
|
||||
# Yield execution to venv command
|
||||
$*
|
||||
|
@ -22,9 +22,9 @@ from ceilometer import storage
|
||||
|
||||
def main(argv):
|
||||
cfg.CONF([], project='ceilometer')
|
||||
if os.getenv("CEILOMETER_TEST_HBASE_URL"):
|
||||
if os.getenv("CEILOMETER_TEST_STORAGE_URL", "").startswith("hbase://"):
|
||||
url = ("%s?table_prefix=%s" %
|
||||
(os.getenv("CEILOMETER_TEST_HBASE_URL"),
|
||||
(os.getenv("CEILOMETER_TEST_STORAGE_URL"),
|
||||
os.getenv("CEILOMETER_TEST_HBASE_TABLE_PREFIX", "test")))
|
||||
conn = storage.get_connection(url, 'ceilometer.metering.storage')
|
||||
event_conn = storage.get_connection(url, 'ceilometer.event.storage')
|
||||
|
Loading…
Reference in New Issue
Block a user