Skip to content

Commit

Permalink
Set UID value directly
Browse files Browse the repository at this point in the history
We were overriding the UID() function to always return "abcde"
in a test.So, if we ran tests multiple times (e.g. -count=10),
any test that relied on UID() would fail from the second time
onwards
  • Loading branch information
dibyom committed Apr 27, 2020
1 parent 32810e5 commit d1b27f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/template/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ func Test_ApplyUIDToResourceTemplate(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// This seeds UID() to return 'abcde'
UID = func() string { return "abcde" }
actualRt := ApplyUIDToResourceTemplate(tt.rt, UID())
//UID = func() string { return "abcde" }
actualRt := ApplyUIDToResourceTemplate(tt.rt, "abcde")
if diff := cmp.Diff(string(tt.expectedRt), string(actualRt)); diff != "" {
t.Errorf("ApplyUIDToResourceTemplate(): -want +got: %s", diff)
}
Expand Down

0 comments on commit d1b27f2

Please sign in to comment.