[PATCH 0/6] Fixes for Wok, Kimchi and make-check

Hi all, With this patch set, all the test cases passed on my Ubuntu system. \o/ While testing it, please, make sure your system does not have any leftovers from the previous attempts to run make-check. Run the following commands to make sure your system only has what it is expected: sudo virsh list --all sudo virsh net-list --all sudo virsh pool-list --all sudo ls -lha /var/lib/libvirt/images sudo ls -lhs <kimchi-dir>/data/debugreports And on Fedora, the failures were reduced to 4. I will investigate them later. Below is the output from 'make check' on my Fedora system: ====================================================================== FAIL: test_storagevolume_action (test_model_storagevolume.StorageVolumeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "test_model_storagevolume.py", line 280, in test_storagevolume_action _do_volume_test(self, model, host, ssl_port, 'default') File "test_model_storagevolume.py", line 122, in _do_volume_test self.assertEquals(500, resp.status) AssertionError: 500 != 200 [21/Oct/2015:21:19:58] ENGINE Waiting for child threads to terminate... ====================================================================== FAIL: test_async_tasks (test_model.ModelTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "test_model.py", line 917, in test_async_tasks self.assertEquals(1, taskid) AssertionError: 1 != 2 ====================================================================== FAIL: test_debug_reports (test_model.ModelTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "test_model.py", line 1098, in test_debug_reports "It is not necessary an error. " AssertionError: It is not necessary an error. You may need to increase the timeout number by TEST_REPORT_TIMEOUT=200 ./run_tests.sh test_model ====================================================================== FAIL: test_vlan_tag_bridge (test_mock_network.MockNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "test_mock_network.py", line 73, in test_vlan_tag_bridge 'interface': iface, 'vlan_id': 987}) File "test_model_network.py", line 70, in _do_network_test self.assertEquals(201, resp.status) AssertionError: 201 != 500 ---------------------------------------------------------------------- Ran 121 tests in 215.991s FAILED (failures=4) Aline Manera (6): Force a HTTP redirection when a resource has its ID changed after a PUT request Make sure to use relative path when setting an icon to a guest Update test case to use the right Template URI while creating a guest Update test case according to commit e9cd4666 Use right URI while doing internal redirection Fix test cases to proper get the screenshot and debug report file src/wok/control/base.py | 4 ++-- src/wok/plugins/kimchi/API.json | 4 ++-- src/wok/plugins/kimchi/control/debugreports.py | 3 ++- src/wok/plugins/kimchi/control/vms.py | 3 ++- src/wok/plugins/kimchi/tests/test_mockmodel.py | 5 +++-- src/wok/plugins/kimchi/tests/test_model.py | 3 --- src/wok/plugins/kimchi/tests/test_rest.py | 12 ++++++------ src/wok/plugins/kimchi/tests/test_template.py | 5 +++-- 8 files changed, 20 insertions(+), 19 deletions(-) -- 2.1.0

The correct exception to raise when a resource has its ID changed is cherrypy.HTTPRedirect to inform user about the new resource URI. cherrypy.InternalRedirect is for automatic redirection (without informing the client about that). Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/control/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wok/control/base.py b/src/wok/control/base.py index e9ed3c8..638e196 100644 --- a/src/wok/control/base.py +++ b/src/wok/control/base.py @@ -66,12 +66,12 @@ class Resource(object): if arg is None: arg = '' uri_params.append(urllib2.quote(arg.encode('utf-8'), safe="")) - raise internal_redirect(self.uri_fmt % tuple(uri_params)) + raise cherrypy.HTTPRedirect(self.uri_fmt % tuple(uri_params), code) elif action_result is not None and action_result != self.ident: uri_params = list(self.model_args[:-1]) uri_params += [urllib2.quote(action_result.encode('utf-8'), safe="")] - raise internal_redirect(self.uri_fmt % tuple(uri_params)) + raise cherrypy.HTTPRedirect(self.uri_fmt % tuple(uri_params), code) def generate_action_handler(self, action_name, action_args=None, destructive=False): -- 2.1.0

Also update the test cases according to lastest changes on Wok and Kimchi as a plugin. Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/API.json | 4 ++-- src/wok/plugins/kimchi/tests/test_rest.py | 4 ++-- src/wok/plugins/kimchi/tests/test_template.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/wok/plugins/kimchi/API.json b/src/wok/plugins/kimchi/API.json index fc1d2dd..b718dcd 100644 --- a/src/wok/plugins/kimchi/API.json +++ b/src/wok/plugins/kimchi/API.json @@ -428,7 +428,7 @@ "icon": { "description": "The template icon path", "type": "string", - "pattern": "^/plugins/kimchi/images/", + "pattern": "^plugins/kimchi/images/", "error": "KCHTMPL0009E" }, "os_distro": { @@ -600,7 +600,7 @@ "icon": { "description": "The template icon path", "type": "string", - "pattern": "^/plugins/kimchi/images/", + "pattern": "^plugins/kimchi/images/", "error": "KCHTMPL0009E" }, "os_distro": { diff --git a/src/wok/plugins/kimchi/tests/test_rest.py b/src/wok/plugins/kimchi/tests/test_rest.py index e1a2f54..b7fa2e1 100644 --- a/src/wok/plugins/kimchi/tests/test_rest.py +++ b/src/wok/plugins/kimchi/tests/test_rest.py @@ -259,7 +259,7 @@ class RestTests(unittest.TestCase): def test_vm_lifecycle(self): # Create a Template req = json.dumps({'name': 'test', 'disks': [{'size': 1}], - 'icon': 'images/icon-debian.png', + 'icon': 'plugins/kimchi/images/icon-debian.png', 'cdrom': fake_iso}) resp = self.request('/plugins/kimchi/templates', req, 'POST') self.assertEquals(201, resp.status) @@ -275,7 +275,7 @@ class RestTests(unittest.TestCase): # Verify the VM vm = json.loads(self.request('/plugins/kimchi/vms/test-vm').read()) self.assertEquals('shutoff', vm['state']) - self.assertEquals('images/icon-debian.png', vm['icon']) + self.assertEquals('plugins/kimchi/images/icon-debian.png', vm['icon']) # Verify the volume was created vol_uri = '/plugins/kimchi/storagepools/default-pool/storagevolumes/' \ diff --git a/src/wok/plugins/kimchi/tests/test_template.py b/src/wok/plugins/kimchi/tests/test_template.py index 6a1a663..c8f29f0 100644 --- a/src/wok/plugins/kimchi/tests/test_template.py +++ b/src/wok/plugins/kimchi/tests/test_template.py @@ -161,11 +161,12 @@ class TemplateTests(unittest.TestCase): self.assertEquals(tmpl, update_tmpl) # Update icon - req = json.dumps({'icon': 'kimchi/images/icon-fedora.png'}) + req = json.dumps({'icon': 'plugins/kimchi/images/icon-fedora.png'}) resp = self.request(new_tmpl_uri, req, 'PUT') self.assertEquals(200, resp.status) update_tmpl = json.loads(resp.read()) - self.assertEquals('kimchi/images/icon-fedora.png', update_tmpl['icon']) + self.assertEquals('plugins/kimchi/images/icon-fedora.png', + update_tmpl['icon']) # Update os_distro and os_version req = json.dumps({'os_distro': 'fedora', 'os_version': '21'}) -- 2.1.0

You used a slash ("/") before any path or URI that code is working on in all other patches, but only in this one you removed all slashes from the beginning of the paths. Why? Paulo Vital. On Wed, 2015-10-21 at 21:40 -0200, Aline Manera wrote:
Also update the test cases according to lastest changes on Wok and Kimchi as a plugin.
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/API.json | 4 ++-- src/wok/plugins/kimchi/tests/test_rest.py | 4 ++-- src/wok/plugins/kimchi/tests/test_template.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/wok/plugins/kimchi/API.json b/src/wok/plugins/kimchi/API.json index fc1d2dd..b718dcd 100644 --- a/src/wok/plugins/kimchi/API.json +++ b/src/wok/plugins/kimchi/API.json @@ -428,7 +428,7 @@ "icon": { "description": "The template icon path", "type": "string", - "pattern": "^/plugins/kimchi/images/", + "pattern": "^plugins/kimchi/images/", "error": "KCHTMPL0009E" }, "os_distro": { @@ -600,7 +600,7 @@ "icon": { "description": "The template icon path", "type": "string", - "pattern": "^/plugins/kimchi/images/", + "pattern": "^plugins/kimchi/images/", "error": "KCHTMPL0009E" }, "os_distro": { diff --git a/src/wok/plugins/kimchi/tests/test_rest.py b/src/wok/plugins/kimchi/tests/test_rest.py index e1a2f54..b7fa2e1 100644 --- a/src/wok/plugins/kimchi/tests/test_rest.py +++ b/src/wok/plugins/kimchi/tests/test_rest.py @@ -259,7 +259,7 @@ class RestTests(unittest.TestCase): def test_vm_lifecycle(self): # Create a Template req = json.dumps({'name': 'test', 'disks': [{'size': 1}], - 'icon': 'images/icon-debian.png', + 'icon': 'plugins/kimchi/images/icon -debian.png', 'cdrom': fake_iso}) resp = self.request('/plugins/kimchi/templates', req, 'POST') self.assertEquals(201, resp.status) @@ -275,7 +275,7 @@ class RestTests(unittest.TestCase): # Verify the VM vm = json.loads(self.request('/plugins/kimchi/vms/test -vm').read()) self.assertEquals('shutoff', vm['state']) - self.assertEquals('images/icon-debian.png', vm['icon']) + self.assertEquals('plugins/kimchi/images/icon-debian.png', vm['icon'])
# Verify the volume was created vol_uri = '/plugins/kimchi/storagepools/default -pool/storagevolumes/' \ diff --git a/src/wok/plugins/kimchi/tests/test_template.py b/src/wok/plugins/kimchi/tests/test_template.py index 6a1a663..c8f29f0 100644 --- a/src/wok/plugins/kimchi/tests/test_template.py +++ b/src/wok/plugins/kimchi/tests/test_template.py @@ -161,11 +161,12 @@ class TemplateTests(unittest.TestCase): self.assertEquals(tmpl, update_tmpl)
# Update icon - req = json.dumps({'icon': 'kimchi/images/icon-fedora.png'}) + req = json.dumps({'icon': 'plugins/kimchi/images/icon -fedora.png'}) resp = self.request(new_tmpl_uri, req, 'PUT') self.assertEquals(200, resp.status) update_tmpl = json.loads(resp.read()) - self.assertEquals('kimchi/images/icon-fedora.png', update_tmpl['icon']) + self.assertEquals('plugins/kimchi/images/icon-fedora.png', + update_tmpl['icon'])
# Update os_distro and os_version req = json.dumps({'os_distro': 'fedora', 'os_version': '21'})

Hi Paulo, The other patches uses the API to do tests. In that case, we need to use the absolute API. But when storing APIs internally to an object JSON, we should use relative API, so UI can properly handle the case in which user configures the proxy to use a different prefix than /, for example, /wok Does that make sense? Regards, Aline Manera On 22/10/2015 08:46, Paulo Ricardo Paz Vital wrote:
You used a slash ("/") before any path or URI that code is working on in all other patches, but only in this one you removed all slashes from the beginning of the paths. Why?
Paulo Vital.
On Wed, 2015-10-21 at 21:40 -0200, Aline Manera wrote:
Also update the test cases according to lastest changes on Wok and Kimchi as a plugin.
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/API.json | 4 ++-- src/wok/plugins/kimchi/tests/test_rest.py | 4 ++-- src/wok/plugins/kimchi/tests/test_template.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/wok/plugins/kimchi/API.json b/src/wok/plugins/kimchi/API.json index fc1d2dd..b718dcd 100644 --- a/src/wok/plugins/kimchi/API.json +++ b/src/wok/plugins/kimchi/API.json @@ -428,7 +428,7 @@ "icon": { "description": "The template icon path", "type": "string", - "pattern": "^/plugins/kimchi/images/", + "pattern": "^plugins/kimchi/images/", "error": "KCHTMPL0009E" }, "os_distro": { @@ -600,7 +600,7 @@ "icon": { "description": "The template icon path", "type": "string", - "pattern": "^/plugins/kimchi/images/", + "pattern": "^plugins/kimchi/images/", "error": "KCHTMPL0009E" }, "os_distro": { diff --git a/src/wok/plugins/kimchi/tests/test_rest.py b/src/wok/plugins/kimchi/tests/test_rest.py index e1a2f54..b7fa2e1 100644 --- a/src/wok/plugins/kimchi/tests/test_rest.py +++ b/src/wok/plugins/kimchi/tests/test_rest.py @@ -259,7 +259,7 @@ class RestTests(unittest.TestCase): def test_vm_lifecycle(self): # Create a Template req = json.dumps({'name': 'test', 'disks': [{'size': 1}], - 'icon': 'images/icon-debian.png', + 'icon': 'plugins/kimchi/images/icon -debian.png', 'cdrom': fake_iso}) resp = self.request('/plugins/kimchi/templates', req, 'POST') self.assertEquals(201, resp.status) @@ -275,7 +275,7 @@ class RestTests(unittest.TestCase): # Verify the VM vm = json.loads(self.request('/plugins/kimchi/vms/test -vm').read()) self.assertEquals('shutoff', vm['state']) - self.assertEquals('images/icon-debian.png', vm['icon']) + self.assertEquals('plugins/kimchi/images/icon-debian.png', vm['icon'])
# Verify the volume was created vol_uri = '/plugins/kimchi/storagepools/default -pool/storagevolumes/' \ diff --git a/src/wok/plugins/kimchi/tests/test_template.py b/src/wok/plugins/kimchi/tests/test_template.py index 6a1a663..c8f29f0 100644 --- a/src/wok/plugins/kimchi/tests/test_template.py +++ b/src/wok/plugins/kimchi/tests/test_template.py @@ -161,11 +161,12 @@ class TemplateTests(unittest.TestCase): self.assertEquals(tmpl, update_tmpl)
# Update icon - req = json.dumps({'icon': 'kimchi/images/icon-fedora.png'}) + req = json.dumps({'icon': 'plugins/kimchi/images/icon -fedora.png'}) resp = self.request(new_tmpl_uri, req, 'PUT') self.assertEquals(200, resp.status) update_tmpl = json.loads(resp.read()) - self.assertEquals('kimchi/images/icon-fedora.png', update_tmpl['icon']) + self.assertEquals('plugins/kimchi/images/icon-fedora.png', + update_tmpl['icon'])
# Update os_distro and os_version req = json.dumps({'os_distro': 'fedora', 'os_version': '21'})

On Thu, 2015-10-22 at 13:52 -0200, Aline Manera wrote:
Hi Paulo,
The other patches uses the API to do tests. In that case, we need to use the absolute API. But when storing APIs internally to an object JSON, we should use relative API, so UI can properly handle the case in which user configures the proxy to use a different prefix than /, for example, /wok
Does that make sense?
Now I understood! :-D
Regards, Aline Manera
On 22/10/2015 08:46, Paulo Ricardo Paz Vital wrote:
You used a slash ("/") before any path or URI that code is working on in all other patches, but only in this one you removed all slashes from the beginning of the paths. Why?
Paulo Vital.
On Wed, 2015-10-21 at 21:40 -0200, Aline Manera wrote:
Also update the test cases according to lastest changes on Wok and Kimchi as a plugin.
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/API.json | 4 ++-- src/wok/plugins/kimchi/tests/test_rest.py | 4 ++-- src/wok/plugins/kimchi/tests/test_template.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/wok/plugins/kimchi/API.json b/src/wok/plugins/kimchi/API.json index fc1d2dd..b718dcd 100644 --- a/src/wok/plugins/kimchi/API.json +++ b/src/wok/plugins/kimchi/API.json @@ -428,7 +428,7 @@ "icon": { "description": "The template icon path", "type": "string", - "pattern": "^/plugins/kimchi/images/", + "pattern": "^plugins/kimchi/images/", "error": "KCHTMPL0009E" }, "os_distro": { @@ -600,7 +600,7 @@ "icon": { "description": "The template icon path", "type": "string", - "pattern": "^/plugins/kimchi/images/", + "pattern": "^plugins/kimchi/images/", "error": "KCHTMPL0009E" }, "os_distro": { diff --git a/src/wok/plugins/kimchi/tests/test_rest.py b/src/wok/plugins/kimchi/tests/test_rest.py index e1a2f54..b7fa2e1 100644 --- a/src/wok/plugins/kimchi/tests/test_rest.py +++ b/src/wok/plugins/kimchi/tests/test_rest.py @@ -259,7 +259,7 @@ class RestTests(unittest.TestCase): def test_vm_lifecycle(self): # Create a Template req = json.dumps({'name': 'test', 'disks': [{'size': 1}], - 'icon': 'images/icon-debian.png', + 'icon': 'plugins/kimchi/images/icon -debian.png', 'cdrom': fake_iso}) resp = self.request('/plugins/kimchi/templates', req, 'POST') self.assertEquals(201, resp.status) @@ -275,7 +275,7 @@ class RestTests(unittest.TestCase): # Verify the VM vm = json.loads(self.request('/plugins/kimchi/vms/test -vm').read()) self.assertEquals('shutoff', vm['state']) - self.assertEquals('images/icon-debian.png', vm['icon']) + self.assertEquals('plugins/kimchi/images/icon -debian.png', vm['icon'])
# Verify the volume was created vol_uri = '/plugins/kimchi/storagepools/default -pool/storagevolumes/' \ diff --git a/src/wok/plugins/kimchi/tests/test_template.py b/src/wok/plugins/kimchi/tests/test_template.py index 6a1a663..c8f29f0 100644 --- a/src/wok/plugins/kimchi/tests/test_template.py +++ b/src/wok/plugins/kimchi/tests/test_template.py @@ -161,11 +161,12 @@ class TemplateTests(unittest.TestCase): self.assertEquals(tmpl, update_tmpl)
# Update icon - req = json.dumps({'icon': 'kimchi/images/icon -fedora.png'}) + req = json.dumps({'icon': 'plugins/kimchi/images/icon -fedora.png'}) resp = self.request(new_tmpl_uri, req, 'PUT') self.assertEquals(200, resp.status) update_tmpl = json.loads(resp.read()) - self.assertEquals('kimchi/images/icon-fedora.png', update_tmpl['icon']) + self.assertEquals('plugins/kimchi/images/icon -fedora.png', + update_tmpl['icon'])
# Update os_distro and os_version req = json.dumps({'os_distro': 'fedora', 'os_version': '21'})

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/tests/test_mockmodel.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wok/plugins/kimchi/tests/test_mockmodel.py b/src/wok/plugins/kimchi/tests/test_mockmodel.py index 2e6b60f..4c7926f 100644 --- a/src/wok/plugins/kimchi/tests/test_mockmodel.py +++ b/src/wok/plugins/kimchi/tests/test_mockmodel.py @@ -65,7 +65,8 @@ class MockModelTests(unittest.TestCase): # Create a VM req = json.dumps({'name': 'test', 'cdrom': fake_iso}) request(host, ssl_port, '/plugins/kimchi/templates', req, 'POST') - req = json.dumps({'name': 'test-vm', 'template': '/templates/test'}) + req = json.dumps({'name': 'test-vm', + 'template': '/plugins/kimchi/templates/test'}) resp = request(host, ssl_port, '/plugins/kimchi/vms', req, 'POST') task = json.loads(resp.read()) wait_task(model.task_lookup, task['id']) -- 2.1.0

Commit e9cd4666 changed the way Kimchi validates the image file to create a Template. So update the test cases accordingly. Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/tests/test_model.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/wok/plugins/kimchi/tests/test_model.py b/src/wok/plugins/kimchi/tests/test_model.py index 55117cf..485b078 100644 --- a/src/wok/plugins/kimchi/tests/test_model.py +++ b/src/wok/plugins/kimchi/tests/test_model.py @@ -253,9 +253,6 @@ class ModelTests(unittest.TestCase): self.assertEquals('finished', inst.task_lookup(task_id)['status']) vol_path = inst.storagevolume_lookup('default', vol)['path'] - params = {'name': 'test', 'disks': [{'base': vol_path}]} - self.assertRaises(OperationFailed, inst.templates_create, params) - # Hack the model objstore to add a new template # It is needed as the image file must be a bootable image when # using model -- 2.1.0

While using internal redirection, the URI must be related to the plugin and not related to the whole application. Fix it. Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/control/debugreports.py | 3 ++- src/wok/plugins/kimchi/control/vms.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wok/plugins/kimchi/control/debugreports.py b/src/wok/plugins/kimchi/control/debugreports.py index b5a3072..82cb1cd 100644 --- a/src/wok/plugins/kimchi/control/debugreports.py +++ b/src/wok/plugins/kimchi/control/debugreports.py @@ -58,4 +58,5 @@ class DebugReportContent(Resource): def get(self): self.lookup() - raise internal_redirect(self.info['uri']) + internal_uri = self.info['uri'].replace('plugins/kimchi', '') + raise internal_redirect(internal_uri) diff --git a/src/wok/plugins/kimchi/control/vms.py b/src/wok/plugins/kimchi/control/vms.py index 1b0e3e0..58d4b67 100644 --- a/src/wok/plugins/kimchi/control/vms.py +++ b/src/wok/plugins/kimchi/control/vms.py @@ -64,4 +64,5 @@ class VMScreenShot(Resource): def get(self): self.lookup() - raise internal_redirect(self.info) + internal_uri = self.info.replace('plugins/kimchi', '') + raise internal_redirect(internal_uri) -- 2.1.0

Kimchi uses relative path internally, so while creating tests you need to make sure to proper set the absolute URI accordingly. Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/tests/test_mockmodel.py | 2 +- src/wok/plugins/kimchi/tests/test_rest.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wok/plugins/kimchi/tests/test_mockmodel.py b/src/wok/plugins/kimchi/tests/test_mockmodel.py index 4c7926f..54a1ac8 100644 --- a/src/wok/plugins/kimchi/tests/test_mockmodel.py +++ b/src/wok/plugins/kimchi/tests/test_mockmodel.py @@ -81,7 +81,7 @@ class MockModelTests(unittest.TestCase): resp1 = request(host, ssl_port, '/plugins/kimchi/vms/test-vm') rspBody = resp1.read() testvm_Data = json.loads(rspBody) - screenshotURL = testvm_Data['screenshot'] + screenshotURL = '/' + testvm_Data['screenshot'] time.sleep(5) resp2 = request(host, ssl_port, screenshotURL) self.assertEquals(200, resp2.status) diff --git a/src/wok/plugins/kimchi/tests/test_rest.py b/src/wok/plugins/kimchi/tests/test_rest.py index b7fa2e1..e6cfa5a 100644 --- a/src/wok/plugins/kimchi/tests/test_rest.py +++ b/src/wok/plugins/kimchi/tests/test_rest.py @@ -309,7 +309,7 @@ class RestTests(unittest.TestCase): self.assertEquals(400, resp.status) # Test screenshot - resp = self.request(vm['screenshot'], method='HEAD') + resp = self.request('/' + vm['screenshot'], method='HEAD') self.assertEquals(200, resp.status) self.assertTrue(resp.getheader('Content-type').startswith('image')) @@ -1130,7 +1130,7 @@ class RestTests(unittest.TestCase): resp = self.request('/plugins/kimchi/vms/test-vm/start', '{}', 'POST') vm = json.loads(self.request('/plugins/kimchi/vms/test-vm').read()) - resp = self.request(vm['screenshot'], method='HEAD') + resp = self.request('/' + vm['screenshot'], method='HEAD') self.assertEquals(200, resp.status) self.assertTrue(resp.getheader('Content-type').startswith('image')) @@ -1159,7 +1159,7 @@ class RestTests(unittest.TestCase): vm = json.loads(self.request('/plugins/kimchi/vms/test-vm').read()) img_lnk = vm['screenshot'] self.request('/plugins/kimchi/vms/test-vm', '{}', 'DELETE') - resp = self.request(img_lnk) + resp = self.request('/' + img_lnk) self.assertEquals(404, resp.status) def test_interfaces(self): @@ -1317,7 +1317,7 @@ class RestTests(unittest.TestCase): resp = request(host, ssl_port, '/plugins/kimchi/debugreports/report1') debugre = json.loads(resp.read()) - resp = request(host, ssl_port, debugre['uri']) + resp = request(host, ssl_port, '/' + debugre['uri']) self.assertEquals(200, resp.status) def test_repositories(self): -- 2.1.0

Reviewed-By: Paulo Vital <pvital@linux.vnet.ibm.com> On Wed, 2015-10-21 at 21:40 -0200, Aline Manera wrote:
Hi all,
With this patch set, all the test cases passed on my Ubuntu system. \o/
While testing it, please, make sure your system does not have any leftovers from the previous attempts to run make-check.
Run the following commands to make sure your system only has what it is expected:
sudo virsh list --all sudo virsh net-list --all sudo virsh pool-list --all sudo ls -lha /var/lib/libvirt/images sudo ls -lhs <kimchi-dir>/data/debugreports
And on Fedora, the failures were reduced to 4. I will investigate them later. Below is the output from 'make check' on my Fedora system:
===================================================================== = FAIL: test_storagevolume_action (test_model_storagevolume.StorageVolumeTests) --------------------------------------------------------------------- - Traceback (most recent call last): File "test_model_storagevolume.py", line 280, in test_storagevolume_action _do_volume_test(self, model, host, ssl_port, 'default') File "test_model_storagevolume.py", line 122, in _do_volume_test self.assertEquals(500, resp.status) AssertionError: 500 != 200
[21/Oct/2015:21:19:58] ENGINE Waiting for child threads to terminate... ===================================================================== = FAIL: test_async_tasks (test_model.ModelTests) --------------------------------------------------------------------- - Traceback (most recent call last): File "test_model.py", line 917, in test_async_tasks self.assertEquals(1, taskid) AssertionError: 1 != 2
===================================================================== = FAIL: test_debug_reports (test_model.ModelTests) --------------------------------------------------------------------- - Traceback (most recent call last): File "test_model.py", line 1098, in test_debug_reports "It is not necessary an error. " AssertionError: It is not necessary an error. You may need to increase the timeout number by TEST_REPORT_TIMEOUT=200 ./run_tests.sh test_model
===================================================================== = FAIL: test_vlan_tag_bridge (test_mock_network.MockNetworkTests) --------------------------------------------------------------------- - Traceback (most recent call last): File "test_mock_network.py", line 73, in test_vlan_tag_bridge 'interface': iface, 'vlan_id': 987}) File "test_model_network.py", line 70, in _do_network_test self.assertEquals(201, resp.status) AssertionError: 201 != 500
--------------------------------------------------------------------- - Ran 121 tests in 215.991s FAILED (failures=4)
Aline Manera (6): Force a HTTP redirection when a resource has its ID changed after a PUT request Make sure to use relative path when setting an icon to a guest Update test case to use the right Template URI while creating a guest Update test case according to commit e9cd4666 Use right URI while doing internal redirection Fix test cases to proper get the screenshot and debug report file
src/wok/control/base.py | 4 ++-- src/wok/plugins/kimchi/API.json | 4 ++-- src/wok/plugins/kimchi/control/debugreports.py | 3 ++- src/wok/plugins/kimchi/control/vms.py | 3 ++- src/wok/plugins/kimchi/tests/test_mockmodel.py | 5 +++-- src/wok/plugins/kimchi/tests/test_model.py | 3 --- src/wok/plugins/kimchi/tests/test_rest.py | 12 ++++++------ src/wok/plugins/kimchi/tests/test_template.py | 5 +++-- 8 files changed, 20 insertions(+), 19 deletions(-)
participants (2)
-
Aline Manera
-
Paulo Ricardo Paz Vital