diff --git a/test/e2e_node/remote/remote.go b/test/e2e_node/remote/remote.go index 26d8994f3b9..2b55b02edd3 100644 --- a/test/e2e_node/remote/remote.go +++ b/test/e2e_node/remote/remote.go @@ -207,9 +207,11 @@ func getTestArtifacts(host, testDir string) error { if err := os.MkdirAll(logPath, 0755); err != nil { return fmt.Errorf("failed to create log directory %q: %w", logPath, err) } - // Copy logs to artifacts/hostname - if _, err := runSSHCommand(host, "scp", "-r", fmt.Sprintf("%s:%s/results/*.log", GetHostnameOrIP(host), testDir), logPath); err != nil { - return err + // Copy logs (if any) to artifacts/hostname + if _, err := SSH(host, "ls", fmt.Sprintf("%s:%s/results/*.log", GetHostnameOrIP(host), testDir)); err == nil { + if _, err := runSSHCommand(host, "scp", "-r", fmt.Sprintf("%s:%s/results/*.log", GetHostnameOrIP(host), testDir), logPath); err != nil { + return err + } } // Copy json files (if any) to artifacts. if _, err := SSH(host, "ls", fmt.Sprintf("%s/results/*.json", testDir)); err == nil { @@ -217,12 +219,19 @@ func getTestArtifacts(host, testDir string) error { return err } } + // Copy junit results (if any) to artifacts if _, err := SSH(host, "ls", fmt.Sprintf("%s/results/junit*", testDir)); err == nil { // Copy junit (if any) to the top of artifacts if _, err = runSSHCommand(host, "scp", fmt.Sprintf("%s:%s/results/junit*", GetHostnameOrIP(host), testDir), *resultsDir); err != nil { return err } } + // Copy container logs to artifacts/hostname + if _, err := SSH(host, "chmod", "-R", "a+r", "/var/log/pods"); err == nil { + if _, err = runSSHCommand(host, "scp", "-r", fmt.Sprintf("%s:/var/log/pods/", GetHostnameOrIP(host)), logPath); err != nil { + return err + } + } return nil }