test: wait for time.Now to change before updating stack in pkger test (#22735)
Do this so comparisons between creation time and update time are realistic.pull/22738/head
parent
5e6b0d539b
commit
7171e0752a
|
@ -549,6 +549,13 @@ func TestLauncher_Pkger(t *testing.T) {
|
||||||
})
|
})
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
|
// Wait for time.Now() to move ahead of the stack's latest update time.
|
||||||
|
// We do this so that on Windows (where time.Now() is updated relatively slowly)
|
||||||
|
// it doesn't appear that the stack was updated at the same time it was created.
|
||||||
|
for now := time.Now(); now.Equal(stack.LatestEvent().UpdatedAt); now = time.Now() {
|
||||||
|
time.Sleep(time.Millisecond)
|
||||||
|
}
|
||||||
|
|
||||||
assertStack := func(t *testing.T, st pkger.Stack) {
|
assertStack := func(t *testing.T, st pkger.Stack) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
assert.Equal(t, stack.ID, st.ID)
|
assert.Equal(t, stack.ID, st.ID)
|
||||||
|
|
Loading…
Reference in New Issue