From nobody Sat Apr 20 16:01:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 148796986927318.229124848825563; Fri, 24 Feb 2017 12:57:49 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 713A0820557; Fri, 24 Feb 2017 20:57:46 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id 6406C82051F for ; Fri, 24 Feb 2017 20:57:15 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1OKoUfS098785 for ; Fri, 24 Feb 2017 15:57:10 -0500 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0a-001b2d01.pphosted.com with ESMTP id 28tud3hv9a-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 24 Feb 2017 15:57:09 -0500 Received: from localhost by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 17:57:07 -0300 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 17:57:04 -0300 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.18.232.225]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id 5984C352006C for ; Fri, 24 Feb 2017 15:56:30 -0500 (EST) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1OKv4vE41550010 for ; Fri, 24 Feb 2017 17:57:04 -0300 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1OKv3O9006541 for ; Fri, 24 Feb 2017 17:57:03 -0300 Received: from t440.ibm.com ([9.85.185.29]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1OKuw0F006508; Fri, 24 Feb 2017 17:57:02 -0300 X-Original-To: kimchi-devel@ovirt.org From: Lucio Correia To: Kimchi Devel Date: Fri, 24 Feb 2017 17:56:51 -0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487969812-14088-1-git-send-email-luciojhc@linux.vnet.ibm.com> References: <1487969812-14088-1-git-send-email-luciojhc@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022420-0028-0000-0000-000001994034 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022420-0029-0000-0000-0000149659A0 Message-Id: <1487969812-14088-2-git-send-email-luciojhc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-24_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702240197 Subject: [Kimchi-devel] [PATCH] [Kimchi 1/2] Fix tests to run without proxy X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Connect directly to cherrypy, without using nginx. Use json instead of dictionary, since Cherrypy does not understand a dict as JSON data. Since tests are now ran without nginx proxy, those need to be fixed. Signed-off-by: Lucio Correia --- tests/test_model_storagevolume.py | 4 ++-- tests/test_rest.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_model_storagevolume.py b/tests/test_model_storagevo= lume.py index a1f1db9..638751a 100644 --- a/tests/test_model_storagevolume.py +++ b/tests/test_model_storagevolume.py @@ -28,7 +28,7 @@ import unittest from functools import partial =20 from tests.utils import fake_auth_header, HOST -from tests.utils import patch_auth, PROXY_PORT, request +from tests.utils import patch_auth, PORT, request from tests.utils import rollback_wrapper, run_server, wait_task =20 from wok.config import paths @@ -171,7 +171,7 @@ def _do_volume_test(self, model, pool_name): self.assertEquals('ready for upload', status['message']) =20 # Upload volume content - url =3D 'https://%s:%s' % (HOST, PROXY_PORT) + uri + '/' + fil= ename + url =3D 'http://%s:%s' % (HOST, PORT) + uri + '/' + filename =20 # Create a file with 5M to upload # Max body size is set to 4M so the upload will fail with 413 diff --git a/tests/test_rest.py b/tests/test_rest.py index 4c7ab5b..852e4bd 100644 --- a/tests/test_rest.py +++ b/tests/test_rest.py @@ -909,17 +909,17 @@ class RestTests(unittest.TestCase): ) self.assertEquals(3, len(devs)) resp =3D self.request('/plugins/kimchi/storagepools/tmp/deacti= vate', - {}, 'POST') + '{}', 'POST') self.assertEquals(200, resp.status) =20 # cannot delete storagepool with volumes associate to guests - resp =3D self.request('/plugins/kimchi/storagepools/tmp', {}, + resp =3D self.request('/plugins/kimchi/storagepools/tmp', '{}', 'DELETE') self.assertEquals(400, resp.status) =20 # activate pool resp =3D self.request('/plugins/kimchi/storagepools/tmp/activa= te', - {}, 'POST') + '{}', 'POST') self.assertEquals(200, resp.status) =20 # delete volumes @@ -927,14 +927,14 @@ class RestTests(unittest.TestCase): l =3D '/plugins/kimchi/vms/test-vm/storages/hdd' else: l =3D '/plugins/kimchi/vms/test-vm/storages/vdb' - resp =3D self.request(l, {}, 'DELETE') + resp =3D self.request(l, '{}', 'DELETE') self.assertEquals(204, resp.status) =20 # deactive and delete storage pool resp =3D self.request('/plugins/kimchi/storagepools/tmp/deacti= vate', - {}, 'POST') + '{}', 'POST') self.assertEquals(200, resp.status) - resp =3D self.request('/plugins/kimchi/storagepools/tmp', {}, + resp =3D self.request('/plugins/kimchi/storagepools/tmp', '{}', 'DELETE') =20 self.assertEquals(204, resp.status) @@ -1151,7 +1151,7 @@ class RestTests(unittest.TestCase): self.assertEquals(202, resp.status) task =3D json.loads(resp.read()) wait_task(self._task_lookup, task['id']) - resp =3D self.request('/plugins/kimchi/vms/test-vm', {}, 'GET') + resp =3D self.request('/plugins/kimchi/vms/test-vm', '{}', 'GET') vm_info =3D json.loads(resp.read()) =20 # Test template not changed after vm customise its pool @@ -1246,7 +1246,7 @@ class RestTests(unittest.TestCase): task =3D json.loads(self.request('/plugins/kimchi/vms', req, 'POST').read()) wait_task(self._task_lookup, task['id']) - resp =3D self.request('/plugins/kimchi/vms/test-vm-%i' % i, {}, + resp =3D self.request('/plugins/kimchi/vms/test-vm-%i' % i, '{= }', 'GET') self.assertEquals(resp.status, 200) count =3D len(json.loads(self.request('/plugins/kimchi/vms').read(= ))) --=20 2.7.4 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel From nobody Sat Apr 20 16:01:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1487969855215961.7745343706181; Fri, 24 Feb 2017 12:57:35 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 464B38205B7; Fri, 24 Feb 2017 20:57:34 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id 7C10482051F for ; Fri, 24 Feb 2017 20:57:11 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1OKoV9m098828 for ; Fri, 24 Feb 2017 15:57:11 -0500 Received: from e24smtp01.br.ibm.com (e24smtp01.br.ibm.com [32.104.18.85]) by mx0a-001b2d01.pphosted.com with ESMTP id 28tud3hv9y-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 24 Feb 2017 15:57:10 -0500 Received: from localhost by e24smtp01.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 17:57:08 -0300 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp01.br.ibm.com (10.172.0.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 17:57:07 -0300 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 8B4EF1DC0054 for ; Fri, 24 Feb 2017 15:57:07 -0500 (EST) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1OKv68r34865218 for ; Fri, 24 Feb 2017 17:57:06 -0300 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1OKv5nb006569 for ; Fri, 24 Feb 2017 17:57:05 -0300 Received: from t440.ibm.com ([9.85.185.29]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1OKuw0G006508; Fri, 24 Feb 2017 17:57:04 -0300 X-Original-To: kimchi-devel@ovirt.org From: Lucio Correia To: Kimchi Devel Date: Fri, 24 Feb 2017 17:56:52 -0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487969812-14088-1-git-send-email-luciojhc@linux.vnet.ibm.com> References: <1487969812-14088-1-git-send-email-luciojhc@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022420-1523-0000-0000-000002831988 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022420-1524-0000-0000-00002A1828E2 Message-Id: <1487969812-14088-3-git-send-email-luciojhc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-24_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702240197 Subject: [Kimchi-devel] [PATCH] [Kimchi 2/2] Fix storage volume test to run without nginx X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that test requests are made directly to cherrypy, which aborts connection in case of an HTTP 413 error, the test case needs to be changed to expect for that exception instead. Signed-off-by: Lucio Correia --- tests/test_model_storagevolume.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_model_storagevolume.py b/tests/test_model_storagevo= lume.py index 638751a..36be961 100644 --- a/tests/test_model_storagevolume.py +++ b/tests/test_model_storagevolume.py @@ -26,6 +26,7 @@ import requests import tempfile import unittest from functools import partial +from requests.exceptions import ConnectionError =20 from tests.utils import fake_auth_header, HOST from tests.utils import patch_auth, PORT, request @@ -174,7 +175,10 @@ def _do_volume_test(self, model, pool_name): url =3D 'http://%s:%s' % (HOST, PORT) + uri + '/' + filename =20 # Create a file with 5M to upload - # Max body size is set to 4M so the upload will fail with 413 + # Max body size is set to 4M so the upload should fail with 41= 3. + # Since nginx is not being used for testing anymore, and cherr= ypy + # aborts connection instead of returning a 413 like nginx does, + # test case expects for exception raised by cherrypy. newfile =3D '/tmp/5m-file' with open(newfile, 'wb') as fd: fd.seek(5*1024*1024-1) @@ -187,11 +191,12 @@ def _do_volume_test(self, model, pool_name): tmp_fd.write(data) =20 with open(newfile + '.tmp', 'rb') as tmp_fd: - r =3D requests.put(url, data=3D{'chunk_size': len(data= )}, + error_msg =3D "Connection aborted" + with self.assertRaisesRegexp(ConnectionError, error_ms= g): + requests.put(url, data=3D{'chunk_size': len(data)}, files=3D{'chunk': tmp_fd}, verify=3DFalse, headers=3Dfake_auth_header()) - self.assertEquals(r.status_code, 413) =20 # Do upload index =3D 0 --=20 2.7.4 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel