|
5 | 5 | "context" |
6 | 6 | "encoding/json" |
7 | 7 | "fmt" |
| 8 | + "github.com/openshift/origin/pkg/dataloader" |
8 | 9 | "io" |
9 | 10 | "io/ioutil" |
10 | 11 | "math/rand" |
@@ -302,7 +303,8 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc |
302 | 303 | // this ensures the tests are always run in random order to avoid |
303 | 304 | // any intra-tests dependencies |
304 | 305 | suiteConfig, _ := ginkgo.GinkgoConfiguration() |
305 | | - r := rand.New(rand.NewSource(suiteConfig.RandomSeed)) |
| 306 | + randSeed := suiteConfig.RandomSeed |
| 307 | + r := rand.New(rand.NewSource(randSeed)) |
306 | 308 | r.Shuffle(len(tests), func(i, j int) { tests[i], tests[j] = tests[j], tests[i] }) |
307 | 309 |
|
308 | 310 | count := o.Count |
@@ -748,6 +750,8 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc |
748 | 750 | if err := riskanalysis.WriteJobRunTestFailureSummary(o.JUnitDir, timeSuffix, finalSuiteResults, wasMasterNodeUpdated, ""); err != nil { |
749 | 751 | fmt.Fprintf(o.Out, "error: Unable to write e2e job run failures summary: %v", err) |
750 | 752 | } |
| 753 | + |
| 754 | + writeRunSuiteOptions(randSeed, monitorTestInfo, o.JUnitDir, timeSuffix) |
751 | 755 | } |
752 | 756 |
|
753 | 757 | switch { |
@@ -779,6 +783,23 @@ func isBlockingFailure(test *testCase) bool { |
779 | 783 | } |
780 | 784 | } |
781 | 785 |
|
| 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 | + |
782 | 803 | func writeExtensionTestResults(tests []*testCase, dir, filePrefix, fileSuffix string, out io.Writer) error { |
783 | 804 | // Ensure the directory exists |
784 | 805 | err := os.MkdirAll(dir, 0755) |
|
0 commit comments