diff --git a/lib/lxc.sh b/lib/lxc.sh index 4b2dabd..0595eef 100644 --- a/lib/lxc.sh +++ b/lib/lxc.sh @@ -48,8 +48,7 @@ LXC_CREATE () { log_critical "Failed to run 'test -e /etc/yunohost' on the container ... either the container did not start, or YunoHost doesn't exists yet in the container :/" fi - set_witness_files - _PREINSTALL_APT_DEPS + _STUFF_TO_RUN_BEFORE_INITIAL_SNAPSHOT sleep 3 log_info "Creating initial snapshot $LXC_NAME ..." diff --git a/lib/tests.sh b/lib/tests.sh index 4fd0de5..b719b3b 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -4,13 +4,23 @@ # "Low-level" logistic helpers #================================================= -_PREINSTALL_APT_DEPS() +_STUFF_TO_RUN_BEFORE_INITIAL_SNAPSHOT() { + # Print the version of YunoHost from the LXC container + log_small_title "YunoHost versions" + lxc exec $LXC_NAME -t -- /bin/bash -c "yunohost --version" | tee -a "$full_log" >/dev/null + + log_title "Package linter" + ./package_linter/package_linter.py "$package_path" | tee -a "$full_log" + + # Set witness files + set_witness_files + [[ -e $package_path/manifest.toml ]] || return local apt_deps=$(python3 -c "import toml, sys; t = toml.loads(sys.stdin.read()); p = t['resources'].get('apt', {}).get('packages', ''); print(p.replace(',', ' ')) if isinstance(p, str) else print(' '.join(p));" < $package_path/manifest.toml) - log_small_title "Preinstalling apt dependencies before creating the initial snapshot..." + log_title "Preinstalling apt dependencies before creating the initial snapshot..." apt="LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get --assume-yes --quiet -o=Acquire::Retries=3 -o=Dpkg::Use-Pty=0" # Execute the command given in argument in the container and log its results. @@ -371,7 +381,6 @@ TEST_PACKAGE_LINTER () { start_test "Package linter" # Execute package linter and linter_result gets the return code of the package linter - ./package_linter/package_linter.py "$package_path" | tee -a "$full_log" ./package_linter/package_linter.py "$package_path" --json | tee -a "$full_log" > $current_test_results return ${PIPESTATUS[0]} diff --git a/lib/tests_coordination.sh b/lib/tests_coordination.sh index 5369b9e..8c384b2 100644 --- a/lib/tests_coordination.sh +++ b/lib/tests_coordination.sh @@ -72,12 +72,7 @@ run_all_tests() { check_lxd_setup LXC_RESET LXC_CREATE - # Be sure that the container is running - LXC_EXEC "true" - # Print the version of YunoHost from the LXC container - log_small_title "YunoHost versions" - LXC_EXEC "yunohost --version" LXC_EXEC "yunohost --version --output-as json" | jq -r .yunohost.version >> $TEST_CONTEXT/ynh_version LXC_EXEC "yunohost --version --output-as json" | jq -r .yunohost.repo >> $TEST_CONTEXT/ynh_branch echo $ARCH > $TEST_CONTEXT/architecture