test: Emit ginkgo log for each node e2e

When running multiple node e2e with multiple machine images, the tests
are run separately for each node. The final build log has all of the
results for each of the hosts combined together which make debugging the
log difficult. To make it easier, emit a log for each host that was run.
This log will be written to the results directory and uploaded as an
artifact in prow jobs.

Signed-off-by: David Porter <david@porter.me>
This commit is contained in:
David Porter 2023-02-25 00:40:15 -08:00
parent 0980f026c9
commit e9ecdf3534
2 changed files with 8 additions and 5 deletions

View File

@ -196,12 +196,15 @@ func (n *NodeE2ERemote) RunTest(host, workspace, results, imageDesc, junitFilePr
systemSpecFile = systemSpecName + ".yaml" systemSpecFile = systemSpecName + ".yaml"
} }
outputGinkgoFile := filepath.Join(results, fmt.Sprintf("%s-ginkgo.log", host))
// Run the tests // Run the tests
klog.V(2).Infof("Starting tests on %q", host) klog.V(2).Infof("Starting tests on %q", host)
cmd := getSSHCommand(" && ", cmd := getSSHCommand(" && ",
fmt.Sprintf("cd %s", workspace), fmt.Sprintf("cd %s", workspace),
fmt.Sprintf("timeout -k 30s %fs ./ginkgo %s ./e2e_node.test -- --system-spec-name=%s --system-spec-file=%s --extra-envs=%s --runtime-config=%s --v 4 --node-name=%s --report-dir=%s --report-prefix=%s --image-description=\"%s\" %s", // Note, we need to have set -o pipefail here to ensure we return the appriorate exit code from ginkgo; not tee
timeout.Seconds(), ginkgoArgs, systemSpecName, systemSpecFile, extraEnvs, runtimeConfig, host, results, junitFilePrefix, imageDesc, testArgs), fmt.Sprintf("set -o pipefail; timeout -k 30s %fs ./ginkgo %s ./e2e_node.test -- --system-spec-name=%s --system-spec-file=%s --extra-envs=%s --runtime-config=%s --v 4 --node-name=%s --report-dir=%s --report-prefix=%s --image-description=\"%s\" %s 2>&1 | tee -i %s",
timeout.Seconds(), ginkgoArgs, systemSpecName, systemSpecFile, extraEnvs, runtimeConfig, host, results, junitFilePrefix, imageDesc, testArgs, outputGinkgoFile),
) )
return SSH(host, "sh", "-c", cmd) return SSH(host, "/bin/bash", "-c", cmd)
} }

View File

@ -289,9 +289,9 @@ func main() {
fmt.Printf("%s\n", tr.output) fmt.Printf("%s\n", tr.output)
if tr.err != nil { if tr.err != nil {
errCount++ errCount++
fmt.Printf("Failure Finished Test Suite on Host %s\n%v\n", host, tr.err) fmt.Printf("Failure Finished Test Suite on Host %s. Refer to artifacts directory for ginkgo log for this host.\n%v\n", host, tr.err)
} else { } else {
fmt.Printf("Success Finished Test Suite on Host %s\n", host) fmt.Printf("Success Finished Test Suite on Host %s. Refer to artifacts directory for ginkgo log for this host.\n", host)
} }
exitOk = exitOk && tr.exitOk exitOk = exitOk && tr.exitOk
fmt.Printf("%s<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<%s\n", blue, noColour) fmt.Printf("%s<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<%s\n", blue, noColour)