Skip to content

Commit

Permalink
Fix flaky TestFindOlderVersions due to gofakeit noun collision (#3188)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas11 authored Mar 28, 2024
1 parent e153154 commit 743f7ca
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions provider/pkg/versioning/findOlderVersions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
)

func TestFindOlderVersions(t *testing.T) {
providerA := gofakeit.Noun()
resourceA := gofakeit.Noun()
resourceB := gofakeit.Noun()
providerA := "providerA"
resourceA := "resourceA"
resourceB := "resourceB"
olderVersion := fakeApiVersion(FakeApiVersion{})
versionA := fakeApiVersion(FakeApiVersion{GreaterThan: olderVersion})
versionB := fakeApiVersion(FakeApiVersion{GreaterThan: olderVersion})
Expand All @@ -36,7 +36,7 @@ func TestFindOlderVersions(t *testing.T) {
olderVersion,
},
}
assert.Equal(t, expected, olderVersions)
assert.Equal(t, expected, olderVersions, "olderVersion=%s, versionA=%s, versionB=%s", olderVersion, versionA, versionB)
}

type FakeApiVersion struct {
Expand All @@ -54,7 +54,7 @@ func fakeApiVersion(spec FakeApiVersion) openapi.ApiVersion {
min = min.AddDate(0, 0, 1)
}
if spec.LessThan != "" {
max, _ = time.Parse(ApiVersionLayout, spec.GreaterThan)
max, _ = time.Parse(ApiVersionLayout, spec.LessThan)
max = max.AddDate(0, 0, -1)
}
return gofakeit.DateRange(min, max).Format(ApiVersionLayout)
Expand Down

0 comments on commit 743f7ca

Please sign in to comment.