示例#1
0
 def setUp(self):
     super(ElasticSearchManager, self).setUp()
     self.event_connection = storage.get_connection(self.url, self.conf)
     # prefix each test with unique index name
     self.event_connection.index_name = 'events_%s' % uuid.uuid4().hex
     # force index on write so data is queryable right away
     self.event_connection._refresh_on_write = True
示例#2
0
 def setUp(self):
     super(ElasticSearchManager, self).setUp()
     self.connection = storage.get_connection(self.url, self.conf)
     # prefix each test with unique index name
     inx_uuid = uuidutils.generate_uuid(dashed=False)
     self.connection.index_name = 'events_%s' % inx_uuid
     # force index on write so data is queryable right away
     self.connection._refresh_on_write = True
示例#3
0
文件: db.py 项目: openstack/panko
 def setUp(self):
     super(ElasticSearchManager, self).setUp()
     self.connection = storage.get_connection(
         self.url, self.conf)
     # prefix each test with unique index name
     inx_uuid = uuidutils.generate_uuid(dashed=False)
     self.connection.index_name = 'events_%s' % inx_uuid
     # force index on write so data is queryable right away
     self.connection._refresh_on_write = True
示例#4
0
 def setUp(self):
     super(MongoDbManager, self).setUp()
     with warnings.catch_warnings():
         warnings.filterwarnings(
             action='ignore',
             message='.*you must provide a username and password.*')
         try:
             self.connection = storage.get_connection(self.url, self.conf)
         except storage.StorageBadVersion as e:
             raise testcase.TestSkipped(six.text_type(e))
示例#5
0
文件: db.py 项目: openstack/panko
 def setUp(self):
     super(MongoDbManager, self).setUp()
     with warnings.catch_warnings():
         warnings.filterwarnings(
             action='ignore',
             message='.*you must provide a username and password.*')
         try:
             self.connection = storage.get_connection(self.url, self.conf)
         except storage.StorageBadVersion as e:
             raise testcase.TestSkipped(six.text_type(e))
def main(argv):
    if os.getenv("PANKO_TEST_STORAGE_URL", "").startswith("hbase://"):
        url = ("%s?table_prefix=%s" %
               (os.getenv("PANKO_TEST_STORAGE_URL"),
                os.getenv("PANKO_TEST_HBASE_TABLE_PREFIX", "test")))
        event_conn = storage.get_connection(url, service.prepare_service())
        for arg in argv:
            if arg == "--upgrade":
                event_conn.upgrade()
            if arg == "--clear":
                event_conn.clear()
示例#7
0
    def setUp(self):
        super(HBaseManager, self).setUp()
        self.connection = storage.get_connection(self.url, self.conf)
        # Unique prefix for each test to keep data is distinguished because
        # all test data is stored in one table
        data_prefix = uuidutils.generate_uuid(dashed=False)

        def table(conn, name):
            return mocks.MockHBaseTable(name, conn, data_prefix)

        # Mock only real HBase connection, MConnection "table" method
        # stays origin.
        mock.patch('happybase.Connection.table', new=table).start()
        # We shouldn't delete data and tables after each test,
        # because it last for too long.
        # All tests tables will be deleted in setup-test-env.sh
        mock.patch("happybase.Connection.disable_table",
                   new=mock.MagicMock()).start()
        mock.patch("happybase.Connection.delete_table",
                   new=mock.MagicMock()).start()
        mock.patch("happybase.Connection.create_table",
                   new=mock.MagicMock()).start()
示例#8
0
文件: db.py 项目: openstack/panko
    def setUp(self):
        super(HBaseManager, self).setUp()
        self.connection = storage.get_connection(
            self.url, self.conf)
        # Unique prefix for each test to keep data is distinguished because
        # all test data is stored in one table
        data_prefix = uuidutils.generate_uuid(dashed=False)

        def table(conn, name):
            return mocks.MockHBaseTable(name, conn, data_prefix)

        # Mock only real HBase connection, MConnection "table" method
        # stays origin.
        mock.patch('happybase.Connection.table', new=table).start()
        # We shouldn't delete data and tables after each test,
        # because it last for too long.
        # All tests tables will be deleted in setup-test-env.sh
        mock.patch("happybase.Connection.disable_table",
                   new=mock.MagicMock()).start()
        mock.patch("happybase.Connection.delete_table",
                   new=mock.MagicMock()).start()
        mock.patch("happybase.Connection.create_table",
                   new=mock.MagicMock()).start()
示例#9
0
 def test_get_connection_no_such_engine(self):
     try:
         storage.get_connection('no-such-engine://localhost', None)
     except RuntimeError as err:
         self.assertIn('no-such-engine', six.text_type(err))
示例#10
0
 def test_get_connection(self):
     engine = storage.get_connection('log://localhost', None)
     self.assertIsInstance(engine, impl_log.Connection)
示例#11
0
 def setUp(self):
     super(SQLManager, self).setUp()
     self.connection = storage.get_connection(self.url, self.conf)
示例#12
0
文件: db.py 项目: openstack/panko
 def setUp(self):
     super(SQLManager, self).setUp()
     self.connection = storage.get_connection(self.url, self.conf)
示例#13
0
 def test_get_connection_no_such_engine(self):
     try:
         storage.get_connection('no-such-engine://localhost', None)
     except RuntimeError as err:
         self.assertIn('no-such-engine', six.text_type(err))
示例#14
0
 def test_get_connection(self):
     engine = storage.get_connection('log://localhost', None)
     self.assertIsInstance(engine, impl_log.Connection)