Skip to content

Commit

Permalink
generate after-completion support bundles in parallel (#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya authored Sep 17, 2024
1 parent 3618bd1 commit fabb87b
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions e2e/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -1959,6 +1960,28 @@ func runPlaywrightTest(t *testing.T, tc *cluster.Output, testName string, args .
}

func generateAndCopySupportBundle(t *testing.T, tc *cluster.Output) {
wg := sync.WaitGroup{}
wg.Add(len(tc.Nodes))

for i := range tc.Nodes {
go func(i int, wg *sync.WaitGroup) {
defer wg.Done()
t.Logf("%s: generating host support bundle from node %s", time.Now().Format(time.RFC3339), tc.Nodes[i])
line := []string{"collect-support-bundle-host.sh"}
if stdout, stderr, err := RunCommandOnNode(t, tc, i, line); err != nil {
t.Logf("stdout: %s", stdout)
t.Logf("stderr: %s", stderr)
t.Logf("fail to generate support from node %s bundle: %v", tc.Nodes[i], err)
return
}

t.Logf("%s: copying host support bundle from node %s to local machine", time.Now().Format(time.RFC3339), tc.Nodes[i])
if err := cluster.CopyFileFromNode(tc.Nodes[i], "/root/host.tar.gz", fmt.Sprintf("support-bundle-host-%s.tar.gz", tc.Nodes[i])); err != nil {
t.Logf("fail to copy host support bundle from node %s to local machine: %v", tc.Nodes[i], err)
}
}(i, &wg)
}

node := tc.Nodes[0]
t.Logf("%s: generating cluster support bundle from node %s", time.Now().Format(time.RFC3339), node)
line := []string{"collect-support-bundle-cluster.sh"}
Expand All @@ -1973,21 +1996,7 @@ func generateAndCopySupportBundle(t *testing.T, tc *cluster.Output) {
}
}

for i, node := range tc.Nodes {
t.Logf("%s: generating host support bundle from node %s", time.Now().Format(time.RFC3339), node)
line := []string{"collect-support-bundle-host.sh"}
if stdout, stderr, err := RunCommandOnNode(t, tc, i, line); err != nil {
t.Logf("stdout: %s", stdout)
t.Logf("stderr: %s", stderr)
t.Logf("fail to generate support from node %s bundle: %v", node, err)
continue
}

t.Logf("%s: copying host support bundle from node %s to local machine", time.Now().Format(time.RFC3339), node)
if err := cluster.CopyFileFromNode(node, "/root/host.tar.gz", fmt.Sprintf("support-bundle-host-%s.tar.gz", node)); err != nil {
t.Logf("fail to copy host support bundle from node %s to local machine: %v", node, err)
}
}
wg.Wait()
}

func copyPlaywrightReport(t *testing.T, tc *cluster.Output) {
Expand Down

0 comments on commit fabb87b

Please sign in to comment.