Skip to content

Commit 434451e

Browse files
committed
kolaTestIso: retry failed tests
We've been seeing a lot of testiso flakes lately. Let's try to give ourselves a break by retrying like we do for normal kola runs. This is slightly different because it's not done inside kola but outside kola. For the inside kola retry of testiso we'll wait for coreos/coreos-assembler#3989 to happen.
1 parent f6b43da commit 434451e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

vars/kolaTestIso.groovy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ def call(params = [:]) {
3131
// the signatures for the metal images won't have been created yet.
3232
try {
3333
shwrap("cd ${cosaDir} && cosa kola testiso --inst-insecure ${extraArgs} --output-dir ${outputDir}/${id}")
34+
} catch(e) {
35+
// To cut down on flake errors let's retry the failed tests
36+
if (shwrapRc("cd ${cosaDir} && cosa shell -- test -f ${outputDir}/${id}/report.json") != 0) {
37+
def rerun_tests = shwrapCapture("""
38+
cd ${cosaDir}
39+
cosa shell -- cat ${outputDir}/${id}/report.json | \
40+
jq -r '.tests[] | select(.result == "FAIL") | .name'
41+
""")
42+
echo "Re-running failed tests (flake detection): ${rerun_tests}"
43+
shwrap("cd ${cosaDir} && cosa kola testiso --inst-insecure ${rerun_tests} --output-dir ${outputDir}/${id}/rerun")
44+
} else {
45+
throw e
46+
}
3447
} finally {
3548
shwrap("cd ${cosaDir} && cosa shell -- tar -C ${outputDir} -c --xz ${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
3649
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"

0 commit comments

Comments
 (0)