[Kimchi-devel] [PATCH 2/7] Granular task query test updates
Christy Perez
christy at linux.vnet.ibm.com
Fri Apr 17 15:24:48 UTC 2015
Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
---
tests/test_model.py | 6 +++---
tests/test_model_storagevolume.py | 2 +-
tests/test_rest.py | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index f80f1c9..cf55549 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -160,7 +160,7 @@ def test_vm_lifecycle(self):
self.assertEquals(snap, current_snap)
task = inst.vmsnapshots_create(u'kimchi-vm')
- snap_name = task['target_uri'].split('/')[-1]
+ snap_name = task['target_uri'].split('/')[-2]
rollback.prependDefer(inst.vmsnapshot_delete,
u'kimchi-vm', snap_name)
inst.task_wait(task['id'])
@@ -1142,9 +1142,9 @@ def test_vm_clone(self):
# and make sure both of them complete successfully
task1 = inst.vm_clone(name)
task2 = inst.vm_clone(name)
- clone1_name = task1['target_uri'].split('/')[-1]
+ clone1_name = task1['target_uri'].split('/')[-2]
rollback.prependDefer(inst.vm_delete, clone1_name)
- clone2_name = task2['target_uri'].split('/')[-1]
+ clone2_name = task2['target_uri'].split('/')[-2]
rollback.prependDefer(inst.vm_delete, clone2_name)
inst.task_wait(task1['id'])
task1 = inst.task_lookup(task1['id'])
diff --git a/tests/test_model_storagevolume.py b/tests/test_model_storagevolume.py
index a3c3ce3..11fd90d 100644
--- a/tests/test_model_storagevolume.py
+++ b/tests/test_model_storagevolume.py
@@ -124,7 +124,7 @@ def _task_lookup(taskid):
resp = self.request(vol_uri + '/clone', '{}', 'POST')
self.assertEquals(202, resp.status)
task = json.loads(resp.read())
- cloned_vol_name = task['target_uri'].split('/')[-1]
+ cloned_vol_name = task['target_uri'].split('/')[-2]
rollback.prependDefer(model.storagevolume_delete, pool_name,
cloned_vol_name)
wait_task(_task_lookup, task['id'])
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 812afb7..c759a52 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -370,7 +370,7 @@ def test_vm_lifecycle(self):
wait_task(self._task_lookup, task['id'])
task = json.loads(self.request('/tasks/%s' % task['id'], '{}').read())
self.assertEquals('finished', task['status'])
- clone_vm_name = task['target_uri'].split('/')[-1]
+ clone_vm_name = task['target_uri'].split('/')[-2]
self.assertTrue(re.match(u'test-vm-clone-\d+', clone_vm_name))
resp = self.request('/vms/test-vm', '{}')
@@ -423,7 +423,7 @@ def test_vm_lifecycle(self):
resp = self.request('/vms/test-vm/snapshots', '{}', 'POST')
self.assertEquals(202, resp.status)
task = json.loads(resp.read())
- snap_name = task['target_uri'].split('/')[-1]
+ snap_name = task['target_uri'].split('/')[-2]
wait_task(self._task_lookup, task['id'])
resp = self.request('/tasks/%s' % task['id'], '{}', 'GET')
task = json.loads(resp.read())
@@ -1724,7 +1724,7 @@ def test_upload(self):
task = r.json()
wait_task(self._task_lookup, task['id'], 15)
uri = '/storagepools/default-pool/storagevolumes/%s'
- resp = self.request(uri % task['target_uri'].split('/')[-1])
+ resp = self.request(uri % task['target_uri'].split('/')[-2])
self.assertEquals(200, resp.status)
--
2.1.0
More information about the Kimchi-devel
mailing list