Esempio n. 1
0
    def _load_backend_and_fixtures(self):
        self.mox.StubOutWithMock(sqlite.uuid, 'uuid4')
        for _ in range(10):
            sqlite.uuid.uuid4().AndReturn(self.uuids.next())

        backend = queue.api('burrow.queue.sqlite')

        self.mox.ReplayAll()
        self.assertEqual({'queue_url': 'http://localhost/5678/fake_queue'},
                         backend.create(self.context, 'fake_queue'))
        self.assertEqual({'queue_url': 'http://localhost/5678/fake_queue2'},
                         backend.create(self.context, 'fake_queue2'))
        return backend
Esempio n. 2
0
    def test_create_queue(self):
        self.mox.StubOutWithMock(sqlite.uuid, 'uuid4')
        sqlite.uuid.uuid4().AndReturn(self.uuids.next())
        sqlite.uuid.uuid4().AndReturn(self.uuids.next())
        sqlite.uuid.uuid4().AndReturn(self.uuids.next())
        sqlite.uuid.uuid4().AndReturn(self.uuids.next())
        
        backend = queue.api('burrow.queue.sqlite')

        self.mox.ReplayAll()
        self.assertEqual({'queue_url': 'http://localhost/5678/fake_queue'},
                         backend.create(self.context, 'fake_queue'))

        # Create on an existing queue returns that queue.
        self.assertEqual({'queue_url': 'http://localhost/5678/fake_queue'},
                         backend.create(self.context, 'fake_queue'))

        self.assertEqual({'queue_url': 'http://localhost/5678/fake_queue2'},
                         backend.create(self.context, 'fake_queue2'))
        self.assertEqual({'queue_url': 'http://localhost/6789/fake_queue'},
                         backend.create(context.RequestContext(tenant='6789'),
                                        'fake_queue'),
                         "Two tenants can have same named queue.")
Esempio n. 3
0
 def test_get_sqlite_backend(self):
     backend = queue.api('burrow.queue.sqlite')
     self.assertTrue(isinstance(backend, sqlite.Backend().__class__))
Esempio n. 4
0
 def __init__(self):
     self.queue_api = queue.api()