bug: fix potential race condition in unit test

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
Bobby DeSimone 2019-09-29 14:15:13 -07:00
parent 1fa45c6ec2
commit 8bd79903db
No known key found for this signature in database
GPG key ID: AEE4CF12FE86D07E
2 changed files with 24 additions and 6 deletions

View file

@ -122,7 +122,7 @@ func TestSignedRedirectURL(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
testTimeNow = tt.mockedTime
mockNow.setNow(tt.mockedTime)
got := SignedRedirectURL(tt.key, tt.destination, tt.urlToSign)
if diff := cmp.Diff(got, tt.want); diff != "" {
t.Errorf("SignedRedirectURL() = diff %v", diff)
@ -142,7 +142,7 @@ func Test_timestamp(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
testTimeNow = tt.dontWant
mockNow.setNow(tt.dontWant)
if got := timestamp(); got == tt.dontWant {
t.Errorf("timestamp() = %v, dontWant %v", got, tt.dontWant)
}