From nobody Thu Apr 25 15:06:21 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 1486659983899815.256748456652; Thu, 9 Feb 2017 09:06:23 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id E2B768205F0; Thu, 9 Feb 2017 17:06:22 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 7510C82059B for ; Thu, 9 Feb 2017 17:06:00 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v19Gxxp3147154 for ; Thu, 9 Feb 2017 12:05:59 -0500 Received: from e24smtp05.br.ibm.com (e24smtp05.br.ibm.com [32.104.18.26]) by mx0b-001b2d01.pphosted.com with ESMTP id 28gsqgh3xp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 09 Feb 2017 12:05:59 -0500 Received: from localhost by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Feb 2017 15:05:57 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 9 Feb 2017 15:05:55 -0200 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.18.232.225]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id BEAC91DC0054 for ; Thu, 9 Feb 2017 12:05:55 -0500 (EST) Received: from d24av04.br.ibm.com (d24av04.br.ibm.com [9.8.31.97]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v19H5sGA39125098 for ; Thu, 9 Feb 2017 15:05:54 -0200 Received: from d24av04.br.ibm.com (localhost [127.0.0.1]) by d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v19H5s6X024666 for ; Thu, 9 Feb 2017 15:05:54 -0200 Received: from t440.ibm.com ([9.85.191.221]) by d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v19H5olH024581; Thu, 9 Feb 2017 15:05:53 -0200 X-Original-To: kimchi-devel@ovirt.org From: Lucio Correia To: Kimchi Devel Date: Thu, 9 Feb 2017 15:05:43 -0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486659944-20332-1-git-send-email-luciojhc@linux.vnet.ibm.com> References: <1486659944-20332-1-git-send-email-luciojhc@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020917-0032-0000-0000-0000053CBDD3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020917-0033-0000-0000-000011BEE910 Message-Id: <1486659944-20332-2-git-send-email-luciojhc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-09_11:, , 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-1702090153 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 Reviewed-By: Ramon Medeiros Reviewed-by: Aline Manera --- 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 Thu Apr 25 15:06:21 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 1486659996382622.3249917793328; Thu, 9 Feb 2017 09:06:36 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 1A64D8205C2; Thu, 9 Feb 2017 17:06:34 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 4E52A82059B for ; Thu, 9 Feb 2017 17:06:02 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v19H0d4j017361 for ; Thu, 9 Feb 2017 12:06:01 -0500 Received: from e24smtp03.br.ibm.com (e24smtp03.br.ibm.com [32.104.18.24]) by mx0b-001b2d01.pphosted.com with ESMTP id 28gsbhhunq-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 09 Feb 2017 12:06:01 -0500 Received: from localhost by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Feb 2017 15:05:59 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp03.br.ibm.com (10.172.0.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 9 Feb 2017 15:05:57 -0200 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id D92A31DC006D for ; Thu, 9 Feb 2017 12:05:57 -0500 (EST) Received: from d24av04.br.ibm.com (d24av04.br.ibm.com [9.8.31.97]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v19H5uFl32571542 for ; Thu, 9 Feb 2017 15:05:56 -0200 Received: from d24av04.br.ibm.com (localhost [127.0.0.1]) by d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v19H5utN024692 for ; Thu, 9 Feb 2017 15:05:56 -0200 Received: from t440.ibm.com ([9.85.191.221]) by d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v19H5olI024581; Thu, 9 Feb 2017 15:05:55 -0200 X-Original-To: kimchi-devel@ovirt.org From: Lucio Correia To: Kimchi Devel Date: Thu, 9 Feb 2017 15:05:44 -0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486659944-20332-1-git-send-email-luciojhc@linux.vnet.ibm.com> References: <1486659944-20332-1-git-send-email-luciojhc@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020917-0024-0000-0000-00000151BE9E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020917-0025-0000-0000-00001615E36E Message-Id: <1486659944-20332-3-git-send-email-luciojhc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-09_11:, , 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-1702090153 Subject: [Kimchi-devel] [PATCH] [Kimchi 2/2] Remove test for HTTP error 413 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" Python requests httplib is not prepared to handle 413 errors as required by Cherrypy like nginx is, thus it will not return error 413 when HTTP request data is bigger than max_body_size. Signed-off-by: Lucio Correia --- tests/test_model_storagevolume.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tests/test_model_storagevolume.py b/tests/test_model_storagevo= lume.py index 638751a..b1d03dd 100644 --- a/tests/test_model_storagevolume.py +++ b/tests/test_model_storagevolume.py @@ -173,26 +173,6 @@ def _do_volume_test(self, model, pool_name): # Upload volume content 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 - newfile =3D '/tmp/5m-file' - with open(newfile, 'wb') as fd: - fd.seek(5*1024*1024-1) - fd.write("\0") - rollback.prependDefer(os.remove, newfile) - - with open(newfile, 'rb') as fd: - with open(newfile + '.tmp', 'wb') as tmp_fd: - data =3D fd.read() - tmp_fd.write(data) - - with open(newfile + '.tmp', 'rb') as tmp_fd: - r =3D 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) - # Do upload index =3D 0 chunk_size =3D 2 * 1024 --=20 2.7.4 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel