Skip to content

Commit

Permalink
Merge pull request #286 from b10n1k/openqa_investigate_workers
Browse files Browse the repository at this point in the history
Make last_good_test+last_good_build jobs run on the same worker
  • Loading branch information
mergify[bot] committed Jan 30, 2024
2 parents e817747 + a3013a5 commit 49990c3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
8 changes: 8 additions & 0 deletions openqa-investigate
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ clone() {
[[ $casedir == null ]] && casedir=''
repo=${casedir:-'https://github.com/os-autoinst/os-autoinst-distri-opensuse.git'}
clone_settings+=("CASEDIR=${repo%#*}#${refspec}")
if [[ $name_suffix =~ (last_good_tests_and_build) ]]; then
worker_vars_settings=$(echo "$vars_json" | runjq -r '.WORKER_CLASS') || return $?
if [[ $worker_vars_settings != null ]]; then
clone_settings+=("WORKER_CLASS=${worker_vars_settings}")
else
name+="(unidentified worker class in vars.json)"
fi
fi
fi
[[ -n ${*:5} ]] && clone_settings+=("${@:5}")
# clear "PUBLISH_" settings to avoid overriding production assets
Expand Down
27 changes: 17 additions & 10 deletions test/02-investigate.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source test/init
bpan:source bashplus +err +fs +sym

plan tests 79
plan tests 81

host=localhost
url=https://localhost
Expand All @@ -17,6 +17,16 @@ openqa-cli() {
}
client_call=(openqa-cli)

fetch-vars-json() {
local tid=$1
if [[ $tid -eq 10020 ]]; then
echo '{"TEST_GIT_URL": "https://github.com/os-autoinst/os-autoinst-distri-openQA.git"}'
elif [[ $tid -eq 10022 ]]; then
echo '{"WORKER_CLASS": "foo,duh,bar"}'
else
echo '{}'
fi
}
rc=0
out=$(clone 41 42 2>&1 > /dev/null) || rc=$?
is "$rc" 1 'fails when unable to query job data'
Expand Down Expand Up @@ -135,15 +145,6 @@ _clone_call() {
echo "$@" >&2
}

fetch-vars-json() {
local tid=$1
if [[ $tid -eq 10020 ]]; then
echo '{"TEST_GIT_URL": "https://github.com/os-autoinst/os-autoinst-distri-openQA.git"}'
else
echo '{}'
fi
}

clone_call=_clone_call
try clone 10023 10024
is "$rc" 0 "Successful clone"
Expand All @@ -163,6 +164,12 @@ try clone 10023 10030 foo refspec
is "$rc" 0 "Successful clone"
like "$got" 'CASEDIR=.*/os-autoinst-testrepo.git#refspec' "job is cloned and CASEDIR is set correctly"

try clone 10022 10030 last_good_tests_and_build:123 refspec
has "$got" 'WORKER_CLASS=foo,duh,bar' "job assigns the same WORKER_CLASS"

try clone 10021 10030 last_good_tests_and_build:123 refspec
has "$got" 'unidentified worker class in vars.json' "info shown in the name is WORKER_CLASS is empty"

clone_call=echo
try investigate 10027
is "$rc" 0 'success regardless of actually triggered jobs'
Expand Down

0 comments on commit 49990c3

Please sign in to comment.