Skip to content

Commit c703a17

Browse files
committed
trt-2257: autodl run suite options
1 parent e996f30 commit c703a17

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

pkg/test/ginkgo/cmd_runsuite.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"context"
66
"encoding/json"
77
"fmt"
8+
"github.com/openshift/origin/pkg/dataloader"
89
"io"
910
"io/ioutil"
1011
"math/rand"
@@ -302,7 +303,8 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
302303
// this ensures the tests are always run in random order to avoid
303304
// any intra-tests dependencies
304305
suiteConfig, _ := ginkgo.GinkgoConfiguration()
305-
r := rand.New(rand.NewSource(suiteConfig.RandomSeed))
306+
randSeed := suiteConfig.RandomSeed
307+
r := rand.New(rand.NewSource(randSeed))
306308
r.Shuffle(len(tests), func(i, j int) { tests[i], tests[j] = tests[j], tests[i] })
307309

308310
count := o.Count
@@ -748,6 +750,8 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
748750
if err := riskanalysis.WriteJobRunTestFailureSummary(o.JUnitDir, timeSuffix, finalSuiteResults, wasMasterNodeUpdated, ""); err != nil {
749751
fmt.Fprintf(o.Out, "error: Unable to write e2e job run failures summary: %v", err)
750752
}
753+
754+
writeRunSuiteOptions(randSeed, monitorTestInfo, o.JUnitDir, timeSuffix)
751755
}
752756

753757
switch {
@@ -779,6 +783,23 @@ func isBlockingFailure(test *testCase) bool {
779783
}
780784
}
781785

786+
func writeRunSuiteOptions(seed int64, info monitortestframework.MonitorTestInitializationInfo, artifactDir, timeSuffix string) {
787+
var rows []map[string]string
788+
789+
rows = make([]map[string]string, 0)
790+
rows = append(rows, map[string]string{"RandomSeed": fmt.Sprintf("%d", seed), "ClusterStability": string(info.ClusterStabilityDuringTest)})
791+
dataFile := dataloader.DataFile{
792+
TableName: "run_suite_options",
793+
Schema: map[string]dataloader.DataType{"ClusterStability": dataloader.DataTypeString, "Seed": dataloader.DataTypeInteger},
794+
Rows: rows,
795+
}
796+
fileName := filepath.Join(artifactDir, fmt.Sprintf("run-suite-options%s-%s", timeSuffix, dataloader.AutoDataLoaderSuffix))
797+
err := dataloader.WriteDataFile(fileName, dataFile)
798+
if err != nil {
799+
logrus.WithError(err).Warnf("unable to write data file: %s", fileName)
800+
}
801+
}
802+
782803
func writeExtensionTestResults(tests []*testCase, dir, filePrefix, fileSuffix string, out io.Writer) error {
783804
// Ensure the directory exists
784805
err := os.MkdirAll(dir, 0755)

0 commit comments

Comments
 (0)