Add app_id and timestamp to results.json

This commit is contained in:
Alexandre Aubin 2020-12-25 23:25:33 +01:00
parent 905507d072
commit 1aec4da80d
3 changed files with 8 additions and 4 deletions

View file

@ -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))

View file

@ -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

View file

@ -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