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 {
pkg string // "tailscale.com/types/key"
testName string // "TestFoo"
outcome string // "pass", "fail", "skip"
pkg string // "tailscale.com/types/key" `json:",inline"`
testName string // "TestFoo" `json:",inline"`
outcome string // "pass", "fail", "skip" `json:",omitempty"`
logs bytes.Buffer
isMarkedFlaky bool // set if the test is marked as flaky
issueURL string // 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 `json:",omitempty"`
pkgFinished bool
}
@ -201,6 +201,12 @@ func main() {
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()
type nextRun struct {
tests []*packageTests
@ -320,6 +326,11 @@ func main() {
} else {
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 {
fmt.Println("\n\nNot retrying flaky tests because non-flaky tests failed.")