From 1bc396cfa589355d9a6dae4b5a60b75a5ea7e270 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Mon, 2 Oct 2023 13:57:37 +0100 Subject: [PATCH 1/3] Resolve 4x bugs --- cmd/package | 2 +- framework/python/src/common/session.py | 7 +++---- framework/python/src/common/testreport.py | 12 ++++++++---- framework/python/src/test_orc/test_orchestrator.py | 1 - make/DEBIAN/control | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/package b/cmd/package index 5f24273ac..5348671fd 100755 --- a/cmd/package +++ b/cmd/package @@ -53,4 +53,4 @@ cp -r {framework,modules} $MAKE_SRC_DIR/usr/local/testrun dpkg-deb --build --root-owner-group make # Rename the .deb file -mv make.deb testrun_1-0_amd64.deb \ No newline at end of file +mv make.deb testrun_1-0-1_amd64.deb \ No newline at end of file diff --git a/framework/python/src/common/session.py b/framework/python/src/common/session.py index 638d213a8..2e69345e4 100644 --- a/framework/python/src/common/session.py +++ b/framework/python/src/common/session.py @@ -48,6 +48,7 @@ def __init__(self, config_file): self._load_config() def start(self): + self.reset() self._status = 'Waiting for Device' self._started = datetime.datetime.now() @@ -217,10 +218,8 @@ def get_total_tests(self): def reset(self): self.set_status('Idle') self.set_target_device(None) - self._tests = { - 'total': 0, - 'results': [] - } + self._total_tests = 0 + self._results = [] self._started = None self._finished = None diff --git a/framework/python/src/common/testreport.py b/framework/python/src/common/testreport.py index 02c9d65a9..4cd47c325 100644 --- a/framework/python/src/common/testreport.py +++ b/framework/python/src/common/testreport.py @@ -34,11 +34,10 @@ report_resource_dir = os.path.join(root_dir, RESOURCES_DIR) -font_file = os.path.join(report_resource_dir,'GoogleSans-Regular.ttf') -test_run_img_file = os.path.join(report_resource_dir,'testrun.png') +test_run_img_file = os.path.join(report_resource_dir, 'testrun.png') class TestReport(): - """Represents a previous Test Run report.""" + """Represents a previous Testrun report.""" def __init__(self, status='Non-Compliant', @@ -52,6 +51,7 @@ def __init__(self, self._finished = finished self._total_tests = total_tests self._results = [] + self._report_url = '' def get_status(self): return self._status @@ -80,6 +80,7 @@ def to_json(self): report_json['finished'] = self._finished.strftime(DATE_TIME_FORMAT) report_json['tests'] = {'total': self._total_tests, 'results': self._results} + report_json['report'] = self._report_url return report_json def from_json(self, json_file): @@ -88,12 +89,15 @@ def from_json(self, json_file): self._device['manufacturer'] = json_file['device']['manufacturer'] self._device['model'] = json_file['device']['model'] - if 'firmware' in self._device: + if 'firmware' in json_file['device']: self._device['firmware'] = json_file['device']['firmware'] self._status = json_file['status'] self._started = datetime.strptime(json_file['started'], DATE_TIME_FORMAT) self._finished = datetime.strptime(json_file['finished'], DATE_TIME_FORMAT) + + if 'report' in json_file: + self._report_url = json_file['report'] self._total_tests = json_file['tests']['total'] # Loop through test results diff --git a/framework/python/src/test_orc/test_orchestrator.py b/framework/python/src/test_orc/test_orchestrator.py index 6ab246b5c..d5734d0e8 100644 --- a/framework/python/src/test_orc/test_orchestrator.py +++ b/framework/python/src/test_orc/test_orchestrator.py @@ -354,7 +354,6 @@ def _run_test_module(self, module): module_results = module_results_json["results"] for test_result in module_results: self._session.add_test_result(test_result) - self._session.add_total_tests(1) except (FileNotFoundError, PermissionError, json.JSONDecodeError) as results_error: LOGGER.error( diff --git a/make/DEBIAN/control b/make/DEBIAN/control index 9ad0ed2de..ae56b91c0 100644 --- a/make/DEBIAN/control +++ b/make/DEBIAN/control @@ -1,5 +1,5 @@ Package: Testrun -Version: 1.0 +Version: 1.0.1 Architecture: amd64 Maintainer: Google Homepage: https://github.com/google/testrun From 04ce49b0d05c90a0bce758621454f4407298d419 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Mon, 2 Oct 2023 14:01:39 +0100 Subject: [PATCH 2/3] Increment version in report.pdf --- framework/python/src/common/testreport.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/python/src/common/testreport.py b/framework/python/src/common/testreport.py index 4cd47c325..792ddd22b 100644 --- a/framework/python/src/common/testreport.py +++ b/framework/python/src/common/testreport.py @@ -166,7 +166,8 @@ def generate_pages(self,json_data): return pages def generate_page(self,json_data, page_num, max_page): - version = 'v1.0 (2023-10-02)' # Place holder until available in json report + # Placeholder until available in json report + version = 'v1.0.1 (2023-10-02)' page = '
' page += self.generate_header(json_data) if page_num == 1: From e857776c09e82699d7fa16f99e33d5132d2692e1 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Mon, 2 Oct 2023 14:37:21 +0100 Subject: [PATCH 3/3] Fix API test --- testing/api/test_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/api/test_api.py b/testing/api/test_api.py index c56ef3d73..c92213ca3 100644 --- a/testing/api/test_api.py +++ b/testing/api/test_api.py @@ -450,7 +450,7 @@ def test_stop_running_test(testing_devices, testrun): r = requests.post(f"{API}/system/stop") response = json.loads(r.text) pretty_print(response) - assert response == {"success": "Test Run stopped"} + assert response == {"success": "Testrun stopped"} time.sleep(1) # Validate response r = requests.get(f"{API}/system/status")