From 1aec4da80d067fc19517ae298c0f59c72b37027d Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 25 Dec 2020 23:25:33 +0100 Subject: [PATCH] Add app_id and timestamp to results.json --- lib/analyze_test_results.py | 7 +++++-- lib/tests_coordination.sh | 3 +++ package_check.sh | 2 -- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/analyze_test_results.py b/lib/analyze_test_results.py index 17e2953..37eac57 100644 --- a/lib/analyze_test_results.py +++ b/lib/analyze_test_results.py @@ -1,6 +1,7 @@ import sys import json import os +import time def load_tests(test_folder): @@ -212,18 +213,20 @@ print() summary = { + "app": open(test_context + "/app_id").read().strip(), "commit": open(test_context + "/commit").read().strip(), "architecture": open(test_context + "/architecture").read().strip(), "yunohost_version": open(test_context + "/ynh_version").read().strip(), "yunohost_branch": open(test_context + "/ynh_branch").read().strip(), + "timestamp": int(time.time()), "tests": [{ "test_type": t["test_type"], "test_arg": t["test_arg"], "test_serie": t["test_serie"], "main_result": t["results"]["main_result"] } for t in tests], - "levels": {level.level: level.passed for level in levels[1:]}, - "global_level": global_level.level + "level_results": {level.level: level.passed for level in levels[1:]}, + "level": global_level.level } sys.stderr.write(json.dumps(summary, indent=4)) diff --git a/lib/tests_coordination.sh b/lib/tests_coordination.sh index ed60d7f..6750dfe 100644 --- a/lib/tests_coordination.sh +++ b/lib/tests_coordination.sh @@ -240,6 +240,8 @@ run_all_tests() { mkdir -p $TEST_CONTEXT/tests mkdir -p $TEST_CONTEXT/results + readonly app_id="$(jq -r .id $package_path/manifest.json)" + # Parse the check_process only if it's exist check_process="$package_path/check_process" @@ -273,6 +275,7 @@ run_all_tests() { LXC_START "yunohost --version --output-as json | jq -r .yunohost.version" >> $TEST_CONTEXT/ynh_version LXC_START "yunohost --version --output-as json | jq -r .yunohost.repo" >> $TEST_CONTEXT/ynh_branch echo $ARCH > $TEST_CONTEXT/architecture + echo $app_id > $TEST_CONTEXT/app_id # Init the value for the current test current_test_number=1 diff --git a/package_check.sh b/package_check.sh index 90172f0..e5a8b38 100755 --- a/package_check.sh +++ b/package_check.sh @@ -174,8 +174,6 @@ fetch_or_upgrade_package_linter readonly TEST_CONTEXT=$(mktemp -d /tmp/package_check.XXXXXX) fetch_package_to_test "$path_to_package_to_test" -readonly app_id="$(cat $package_path/manifest.json | jq -r .id)" - run_all_tests clean_exit 0