Skip to content

Commit 87b4ef0

Browse files
allows difftest tests to be skipped if they fail, not pass (#14915)
1 parent 9ab437d commit 87b4ef0

File tree

1 file changed

+6
-4
lines changed
  • mmv1/third_party/terraform/scripts/teamcitytestscripts

1 file changed

+6
-4
lines changed

mmv1/third_party/terraform/scripts/teamcitytestscripts/teamcity.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const (
2222
)
2323

2424
var (
25-
end = regexp.MustCompile(`--- (PASS|SKIP|FAIL):\s+([a-zA-Z_]\S*) \(([\.\d]+)\)`)
25+
// Looks for the final status line, accommodating both simple and full summaries.
26+
end = regexp.MustCompile(`\n(PASS|SKIP|FAIL)(?:[\t\s]+(.*)\s+([0-9\.]+[a-z]+))?\s*$`)
2627
diff = regexp.MustCompile(`\[Diff\] (.*)`)
2728
paniced = regexp.MustCompile(`panic:\s+(.*)\s+\[recovered\]\n`)
2829
//suite = regexp.MustCompile("^(ok|FAIL)\\s+([^\\s]+)\\s+([\\.\\d]+)s")
@@ -86,7 +87,8 @@ func (test *TeamCityTest) FormatTestOutput() string {
8687
}
8788

8889
if test.Fail {
89-
output.WriteString(fmt.Sprintf(TeamCityTestFailed, now, test.Name))
90+
// skip failures for diff tests
91+
output.WriteString(fmt.Sprintf(TeamCityTestIgnored, now, test.Name))
9092
output.WriteString(fmt.Sprintf(TeamCityTestFinished, now, test.Name))
9193
return output.String()
9294
}
@@ -107,8 +109,8 @@ func (test *TeamCityTest) FormatTestOutput() string {
107109
return output.String()
108110
}
109111

110-
// test passes if no diff, even if failure (failure artifacts will be in regular_failure_file.log)
111-
output.WriteString(fmt.Sprintf(TeamCityTestFinished, now, test.Name))
112+
// instead of failing when something unexpected happens, we skip the test now
113+
output.WriteString(fmt.Sprintf(TeamCityTestIgnored, now, test.Name))
112114

113115
return output.String()
114116
}

0 commit comments

Comments
 (0)