This commit is contained in:
Claire Wang 2023-11-21 12:04:21 -05:00
parent 17501ea31a
commit a56a7de9f2

View File

@ -38,12 +38,12 @@ const (
) )
type testAttempt struct { type testAttempt struct {
pkg string // "tailscale.com/types/key" pkg string // "tailscale.com/types/key" `json:",inline"`
testName string // "TestFoo" testName string // "TestFoo" `json:",inline"`
outcome string // "pass", "fail", "skip" outcome string // "pass", "fail", "skip" `json:",omitempty"`
logs bytes.Buffer logs bytes.Buffer
isMarkedFlaky bool // set if the test is marked as flaky isMarkedFlaky bool // set if the test is marked as flaky `json:",omitempty"`
issueURL string // set if the test is marked as flaky issueURL string // set if the test is marked as flaky `json:",omitempty"`
pkgFinished bool pkgFinished bool
} }
@ -201,6 +201,12 @@ func main() {
return return
} }
f, err := os.Create("test_attempts.json")
if err != nil {
log.Printf("error creating test attempt json file: %v", err)
}
defer f.Close()
ctx := context.Background() ctx := context.Background()
type nextRun struct { type nextRun struct {
tests []*packageTests tests []*packageTests
@ -320,6 +326,11 @@ func main() {
} else { } else {
failed = true failed = true
} }
testAttemptJson, _ := json.Marshal(tr)
_, err := f.Write(testAttemptJson)
if err != nil {
log.Printf("error appending to test attempt json file: %v", err)
}
} }
if failed { if failed {
fmt.Println("\n\nNot retrying flaky tests because non-flaky tests failed.") fmt.Println("\n\nNot retrying flaky tests because non-flaky tests failed.")