summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuluyang <1120773382@qq.com>2017-12-04 23:23:44 -0800
committerliuluyang <1120773382@qq.com>2017-12-25 03:04:13 +0000
commit1b2490bdf0d74ab29cfadfe5100fe4d173427f5b (patch)
tree5ddec6e6ee82dee1f7f3ffb703d83a509cb4ff20
parentfce0cb4c25870384a58ae78ed6d2abf777a50a37 (diff)
server group unit testing a bit wrong
the function of create_test_server_group should be used instead create_test_aggregate Change-Id: I383bc563d369144a5f918064309b73e7984b61ab Closes-Bug: #1736331
Notes
Notes (review): Code-Review+1: Dongdong Pei <peidongdong121@163.com> Code-Review+1: zhangxi <1275544132@qq.com> Code-Review+1: Dong Liu <willowd878@gmail.com> Code-Review+1: Xinran WANG <xin-ran.wang@intel.com> Code-Review+1: Ethan <caotianran@awcloud.com> Code-Review+2: Zhenguo Niu <Niu.ZGlinux@gmail.com> Workflow+1: Zhenguo Niu <Niu.ZGlinux@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 05 Feb 2018 04:06:28 +0000 Reviewed-on: https://review.openstack.org/525486 Project: openstack/mogan Branch: refs/heads/master
-rw-r--r--mogan/db/sqlalchemy/api.py2
-rw-r--r--mogan/tests/unit/db/test_server_group.py2
-rw-r--r--mogan/tests/unit/db/utils.py3
3 files changed, 5 insertions, 2 deletions
diff --git a/mogan/db/sqlalchemy/api.py b/mogan/db/sqlalchemy/api.py
index 3b2edc3..fcc67a3 100644
--- a/mogan/db/sqlalchemy/api.py
+++ b/mogan/db/sqlalchemy/api.py
@@ -1006,7 +1006,7 @@ class Connection(api.Connection):
1006 try: 1006 try:
1007 server_group_ref = models.ServerGroup() 1007 server_group_ref = models.ServerGroup()
1008 server_group_ref.update(values) 1008 server_group_ref.update(values)
1009 server_group_ref.save(session) 1009 server_group_ref.save(session=session)
1010 except db_exc.DBDuplicateEntry: 1010 except db_exc.DBDuplicateEntry:
1011 raise exception.ServerGroupExists(group_uuid=values['uuid']) 1011 raise exception.ServerGroupExists(group_uuid=values['uuid'])
1012 if policies: 1012 if policies:
diff --git a/mogan/tests/unit/db/test_server_group.py b/mogan/tests/unit/db/test_server_group.py
index 7195ab9..ecb00d2 100644
--- a/mogan/tests/unit/db/test_server_group.py
+++ b/mogan/tests/unit/db/test_server_group.py
@@ -32,7 +32,7 @@ class DbServerGroupTestCase(base.DbTestCase):
32 members=['server1', 'server2']) 32 members=['server1', 'server2'])
33 33
34 def test_server_group_create(self): 34 def test_server_group_create(self):
35 sg = utils.create_test_aggregate(name='testing') 35 sg = utils.create_test_server_group(name='testing')
36 self.assertEqual('testing', sg.name) 36 self.assertEqual('testing', sg.name)
37 37
38 def test_server_group_get(self): 38 def test_server_group_get(self):
diff --git a/mogan/tests/unit/db/utils.py b/mogan/tests/unit/db/utils.py
index a592ae6..c50158c 100644
--- a/mogan/tests/unit/db/utils.py
+++ b/mogan/tests/unit/db/utils.py
@@ -237,6 +237,9 @@ def create_test_server_group(context={}, **kw):
237 237
238 """ 238 """
239 server_fault = get_test_server_group(**kw) 239 server_fault = get_test_server_group(**kw)
240 # Let DB generate ID if it isn't specified explicitly
241 if 'id' not in kw:
242 del server_fault['id']
240 dbapi = db_api.get_instance() 243 dbapi = db_api.get_instance()
241 members = server_fault.pop('members') 244 members = server_fault.pop('members')
242 policies = server_fault.pop('policies') 245 policies = server_fault.pop('policies')