From bdf5048343f9d3f419bbd16dfb219fa79a9ad694 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sun, 21 May 2017 10:13:45 +0200 Subject: Sort keys when dumping json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise dumping them could break some unit tests as they are unordered collections [1]. [1] https://build.opnfv.org/ci/job/functest-verify-master/4122/ Change-Id: I108e946926ae9690cf2421e565f2bb81500f9160 Signed-off-by: Cédric Ollivier --- functest/utils/functest_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'functest/utils/functest_utils.py') diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index 284c79719..dc20eea10 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -221,7 +221,8 @@ def push_results_to_db(project, case_name, error = None headers = {'Content-Type': 'application/json'} try: - r = requests.post(url, data=json.dumps(params), headers=headers) + r = requests.post(url, data=json.dumps(params, sort_keys=True), + headers=headers) logger.debug(r) r.raise_for_status() except requests.RequestException as exc: -- cgit 1.2.3-korg