Move SQlite ID tests to driver-specific tests.
Change-Id: Ie8d679ba05d18816948953e9a04f00d7419b9405
This commit is contained in:
parent
7e76c9957c
commit
5b2e2254f5
@ -13,9 +13,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from marconi.storage import exceptions
|
||||
from marconi.storage import sqlite
|
||||
from marconi.storage.sqlite import controllers
|
||||
from marconi.tests.storage import base
|
||||
from marconi.tests import util as testing
|
||||
|
||||
|
||||
class SQliteQueueTests(base.QueueControllerTest):
|
||||
@ -27,7 +29,45 @@ class SQliteMessageTests(base.MessageControllerTest):
|
||||
driver_class = sqlite.Driver
|
||||
controller_class = controllers.Message
|
||||
|
||||
def setUp(self):
|
||||
super(SQliteMessageTests, self).setUp()
|
||||
self.queue_controller.upsert('unused', {}, '480924')
|
||||
|
||||
def tearDown(self):
|
||||
self.queue_controller.delete('unused', '480924')
|
||||
super(SQliteMessageTests, self).tearDown()
|
||||
|
||||
def test_illformed_id(self):
|
||||
# any ill-formed IDs should be regarded as non-existing ones.
|
||||
|
||||
self.controller.delete('unused', 'illformed', '480924')
|
||||
|
||||
msgs = list(self.controller.list('unused', '480924',
|
||||
marker='illformed'))
|
||||
|
||||
self.assertEquals(len(msgs), 0)
|
||||
|
||||
with testing.expected(exceptions.DoesNotExist):
|
||||
self.controller.get('unused', 'illformed', '480924')
|
||||
|
||||
|
||||
class SQliteClaimTests(base.ClaimControllerTest):
|
||||
driver_class = sqlite.Driver
|
||||
controller_class = controllers.Claim
|
||||
|
||||
def setUp(self):
|
||||
super(SQliteClaimTests, self).setUp()
|
||||
self.queue_controller.upsert('unused', {}, '480924')
|
||||
|
||||
def tearDown(self):
|
||||
self.queue_controller.delete('unused', '480924')
|
||||
super(SQliteClaimTests, self).tearDown()
|
||||
|
||||
def test_illformed_id(self):
|
||||
# any ill-formed IDs should be regarded as non-existing ones.
|
||||
|
||||
self.controller.delete('unused', 'illformed', '480924')
|
||||
|
||||
with testing.expected(exceptions.DoesNotExist):
|
||||
self.controller.update('unused', 'illformed',
|
||||
{'ttl': 40}, '480924')
|
||||
|
@ -49,12 +49,6 @@ class TestSqlite(testing.TestBase):
|
||||
tenant='480924',
|
||||
client_uuid='79ed56f8')[0]
|
||||
|
||||
#TODO(zyuan): move this to tests/storage/test_impl_sqlite.py
|
||||
msgs = list(self.msg_ctrl.list('fizbit', '480924',
|
||||
marker='illformed'))
|
||||
|
||||
self.assertEquals(len(msgs), 0)
|
||||
|
||||
# can not delete a message with a wrong claim
|
||||
cid_another, _ = self.claim_ctrl.create(
|
||||
'fizbit', {'ttl': 10}, '480924')
|
||||
@ -115,21 +109,6 @@ class TestSqlite(testing.TestBase):
|
||||
countof = self.queue_ctrl.stats('fizbit', '480924')
|
||||
self.assertEquals(countof['messages']['free'], 0)
|
||||
|
||||
#TODO(zyuan): move this to tests/storage/test_impl_sqlite.py
|
||||
def test_illformed_id(self):
|
||||
|
||||
# SQlite-specific tests. Since all IDs exposed in APIs are opaque,
|
||||
# any ill-formed IDs should be regarded as non-existing ones.
|
||||
|
||||
with testing.expected(exceptions.DoesNotExist):
|
||||
self.msg_ctrl.get('nonexistent', 'illformed', '480924')
|
||||
|
||||
self.claim_ctrl.delete('nonexistent', 'illformed', '480924')
|
||||
|
||||
with testing.expected(exceptions.DoesNotExist):
|
||||
self.claim_ctrl.update('nonexistent', 'illformed',
|
||||
{'ttl': 40}, '480924')
|
||||
|
||||
def tearDown(self):
|
||||
self.queue_ctrl.delete('fizbit', '480924')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user