junit: Use the timestamp from the gtr.Report when creating Testsuites

This commit is contained in:
Joël Stemmer
2022-03-15 19:44:26 +00:00
parent b0a9864d1e
commit 4b87b03e55
3 changed files with 15 additions and 11 deletions

View File

@ -191,7 +191,12 @@ func testReport(input, reportFile, packageName string, t *testing.T) {
}
defer file.Close()
parser := gotest.New(gotest.PackageName(packageName))
parser := gotest.New(
gotest.PackageName(packageName),
gotest.TimestampFunc(func() time.Time {
return time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC)
}),
)
report, err := parser.Parse(file)
if err != nil {
@ -204,8 +209,7 @@ func testReport(input, reportFile, packageName string, t *testing.T) {
}
}
testTime := time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC)
actual := junit.CreateFromReport(report, "hostname", testTime)
actual := junit.CreateFromReport(report, "hostname")
expectedXML, err := loadTestReport(reportFile, "")
if err != nil {