From c1e0cb09569a6ff4a6991a532aec5d4409f88123 Mon Sep 17 00:00:00 2001 From: Saqib Ali Date: Tue, 15 Feb 2022 00:16:33 -0500 Subject: [PATCH] kola/harness.go: fix kola panic 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: https://github.com/coreos/coreos-assembler/issues/2701 --- mantle/kola/harness.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mantle/kola/harness.go b/mantle/kola/harness.go index 5f61c78c58..eda6f301b5 100644 --- a/mantle/kola/harness.go +++ b/mantle/kola/harness.go @@ -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