From 6b9e3d83030a6fe63d29bf679db93e4793700ee2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Ollivier?= Date: Mon, 2 Dec 2019 23:43:55 +0100 Subject: [PATCH] Verify Shaker results via json report MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As shaker always returns 0, it verifies the records and returns false after the first failure. Change-Id: I9393be0c65d315c1ca055de9f7f994f9db22eadb Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/openstack/shaker/shaker.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/functest/opnfv_tests/openstack/shaker/shaker.py b/functest/opnfv_tests/openstack/shaker/shaker.py index 9d8a13274..fe52100e0 100644 --- a/functest/opnfv_tests/openstack/shaker/shaker.py +++ b/functest/opnfv_tests/openstack/shaker/shaker.py @@ -19,6 +19,7 @@ and list of tests to execute. import logging import os +import json import scp from functest.core import singlevm @@ -129,6 +130,13 @@ class Shaker(singlevm.SingleVm2): except scp.SCPException: self.__logger.exception("cannot get report files") return 1 + with open(os.path.join(self.res_dir, 'report.json')) as json_file: + data = json.load(json_file) + for value in data["records"].values(): + if value["status"] != "ok": + self.__logger.error( + "%s failed\n%s", value["scenario"], value["stderr"]) + return 1 return stdout.channel.recv_exit_status() def clean(self): -- 2.16.6