Skip to content

Commit fabb87b

Browse files
authored
generate after-completion support bundles in parallel (#1180)
1 parent 3618bd1 commit fabb87b

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

e2e/install_test.go

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"os"
77
"strings"
8+
"sync"
89
"testing"
910
"time"
1011

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

19611962
func generateAndCopySupportBundle(t *testing.T, tc *cluster.Output) {
1963+
wg := sync.WaitGroup{}
1964+
wg.Add(len(tc.Nodes))
1965+
1966+
for i := range tc.Nodes {
1967+
go func(i int, wg *sync.WaitGroup) {
1968+
defer wg.Done()
1969+
t.Logf("%s: generating host support bundle from node %s", time.Now().Format(time.RFC3339), tc.Nodes[i])
1970+
line := []string{"collect-support-bundle-host.sh"}
1971+
if stdout, stderr, err := RunCommandOnNode(t, tc, i, line); err != nil {
1972+
t.Logf("stdout: %s", stdout)
1973+
t.Logf("stderr: %s", stderr)
1974+
t.Logf("fail to generate support from node %s bundle: %v", tc.Nodes[i], err)
1975+
return
1976+
}
1977+
1978+
t.Logf("%s: copying host support bundle from node %s to local machine", time.Now().Format(time.RFC3339), tc.Nodes[i])
1979+
if err := cluster.CopyFileFromNode(tc.Nodes[i], "/root/host.tar.gz", fmt.Sprintf("support-bundle-host-%s.tar.gz", tc.Nodes[i])); err != nil {
1980+
t.Logf("fail to copy host support bundle from node %s to local machine: %v", tc.Nodes[i], err)
1981+
}
1982+
}(i, &wg)
1983+
}
1984+
19621985
node := tc.Nodes[0]
19631986
t.Logf("%s: generating cluster support bundle from node %s", time.Now().Format(time.RFC3339), node)
19641987
line := []string{"collect-support-bundle-cluster.sh"}
@@ -1973,21 +1996,7 @@ func generateAndCopySupportBundle(t *testing.T, tc *cluster.Output) {
19731996
}
19741997
}
19751998

1976-
for i, node := range tc.Nodes {
1977-
t.Logf("%s: generating host support bundle from node %s", time.Now().Format(time.RFC3339), node)
1978-
line := []string{"collect-support-bundle-host.sh"}
1979-
if stdout, stderr, err := RunCommandOnNode(t, tc, i, line); err != nil {
1980-
t.Logf("stdout: %s", stdout)
1981-
t.Logf("stderr: %s", stderr)
1982-
t.Logf("fail to generate support from node %s bundle: %v", node, err)
1983-
continue
1984-
}
1985-
1986-
t.Logf("%s: copying host support bundle from node %s to local machine", time.Now().Format(time.RFC3339), node)
1987-
if err := cluster.CopyFileFromNode(node, "/root/host.tar.gz", fmt.Sprintf("support-bundle-host-%s.tar.gz", node)); err != nil {
1988-
t.Logf("fail to copy host support bundle from node %s to local machine: %v", node, err)
1989-
}
1990-
}
1999+
wg.Wait()
19912000
}
19922001

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

0 commit comments

Comments
 (0)