Skip to content

Commit

Permalink
kola/harness.go: fix kola panic
Browse files Browse the repository at this point in the history
Recently we have seen non-exclusive tests panicking due to
runtime.Goexit executing, but somehow harness.finished being false.
This problem was occurring because we pass tcluster to collectLogsExternalTest
instead of newTC. tcluster has a reference to the harness of the wrapper test,
thus harness.finished is incorrectly set to true for the wrapper test's harness
instead of the non-exclusive subtest's harness.

closes: coreos#2701
  • Loading branch information
saqibali-2k committed Feb 15, 2022
1 parent 0d27be4 commit c1e0cb0
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -1276,17 +1276,23 @@ func makeNonExclusiveTest(bucket int, tests []*register.Test, flight platform.Fl
t := t
run := func(h *harness.H) {
testResults.add(h)
// tcluster has a reference to the wrapper's harness
// We need a new TestCluster that has a reference to the
// subtest being ran
// This will allow timeout logic to work correctly when executing
// functions such as TestCluster.SSH, since these functions
// internally use harness.RunWithExecTimeoutCheck
newTC := cluster.TestCluster{
H: h,
Cluster: tcluster.Cluster,
}
// Install external test executable
if t.ExternalTest != "" {
setupExternalTest(h, t, tcluster)
setupExternalTest(h, t, newTC)
// Collect the journal logs after execution is finished
defer collectLogsExternalTest(h, t, tcluster)
defer collectLogsExternalTest(h, t, newTC)
}

newTC := cluster.TestCluster{
H: h,
Cluster: tcluster.Cluster,
}
t.Run(newTC)
}
// Each non-exclusive test is run as a subtest of this wrapper test
Expand Down

0 comments on commit c1e0cb0

Please sign in to comment.