Merge "add some tests for db"
This commit is contained in:
commit
57e74664d3
@ -63,6 +63,20 @@ class DbClusterTestCase(base.DbTestCase):
|
|||||||
self.dbapi.get_cluster_by_uuid,
|
self.dbapi.get_cluster_by_uuid,
|
||||||
self.context,
|
self.context,
|
||||||
'12345678-9999-0000-aaaa-123456789012')
|
'12345678-9999-0000-aaaa-123456789012')
|
||||||
|
self.assertRaises(exception.ClusterNotFound,
|
||||||
|
self.dbapi.get_cluster_by_name,
|
||||||
|
self.context, 'not_found')
|
||||||
|
|
||||||
|
def test_get_cluster_by_name_multiple_cluster(self):
|
||||||
|
utils.create_test_cluster(
|
||||||
|
id=1, name='clusterone',
|
||||||
|
uuid=uuidutils.generate_uuid())
|
||||||
|
utils.create_test_cluster(
|
||||||
|
id=2, name='clusterone',
|
||||||
|
uuid=uuidutils.generate_uuid())
|
||||||
|
self.assertRaises(exception.Conflict,
|
||||||
|
self.dbapi.get_cluster_by_name,
|
||||||
|
self.context, 'clusterone')
|
||||||
|
|
||||||
def test_get_cluster_list(self):
|
def test_get_cluster_list(self):
|
||||||
uuids = []
|
uuids = []
|
||||||
@ -189,11 +203,15 @@ class DbClusterTestCase(base.DbTestCase):
|
|||||||
self.dbapi.get_cluster_by_uuid, self.context,
|
self.dbapi.get_cluster_by_uuid, self.context,
|
||||||
cluster.uuid)
|
cluster.uuid)
|
||||||
|
|
||||||
def test_destroy_cluster_that_does_not_exist(self):
|
def test_destroy_cluster_by_id_that_does_not_exist(self):
|
||||||
self.assertRaises(exception.ClusterNotFound,
|
self.assertRaises(exception.ClusterNotFound,
|
||||||
self.dbapi.destroy_cluster,
|
self.dbapi.destroy_cluster,
|
||||||
'12345678-9999-0000-aaaa-123456789012')
|
'12345678-9999-0000-aaaa-123456789012')
|
||||||
|
|
||||||
|
def test_destroy_cluster_by_uuid_that_does_not_exist(self):
|
||||||
|
self.assertRaises(exception.ClusterNotFound,
|
||||||
|
self.dbapi.destroy_cluster, '999')
|
||||||
|
|
||||||
def test_update_cluster(self):
|
def test_update_cluster(self):
|
||||||
cluster = utils.create_test_cluster()
|
cluster = utils.create_test_cluster()
|
||||||
old_nc = cluster.node_count
|
old_nc = cluster.node_count
|
||||||
|
@ -140,6 +140,12 @@ class DbClusterTemplateTestCase(base.DbTestCase):
|
|||||||
self.dbapi.get_cluster_template_by_name,
|
self.dbapi.get_cluster_template_by_name,
|
||||||
self.context, 'not_found')
|
self.context, 'not_found')
|
||||||
|
|
||||||
|
def test_get_cluster_template_by_uuid_that_does_not_exist(self):
|
||||||
|
self.assertRaises(exception.ClusterTemplateNotFound,
|
||||||
|
self.dbapi.get_cluster_template_by_uuid,
|
||||||
|
self.context,
|
||||||
|
'12345678-9999-0000-aaaa-123456789012')
|
||||||
|
|
||||||
def test_update_cluster_template(self):
|
def test_update_cluster_template(self):
|
||||||
ct = utils.create_test_cluster_template()
|
ct = utils.create_test_cluster_template()
|
||||||
res = self.dbapi.update_cluster_template(ct['id'],
|
res = self.dbapi.update_cluster_template(ct['id'],
|
||||||
|
Loading…
Reference in New Issue
Block a user