From bd469a3c4b805a12ae12a6a95766debe52ed8fdd Mon Sep 17 00:00:00 2001 From: Mark Mandel Date: Tue, 30 Jun 2020 16:24:05 -0700 Subject: [PATCH] Flaky TestLocal (#1665) Fixed an issue with time slipping in this test. --- pkg/sdkserver/localsdk_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/sdkserver/localsdk_test.go b/pkg/sdkserver/localsdk_test.go index 40d9db3874..e9fa73d753 100644 --- a/pkg/sdkserver/localsdk_test.go +++ b/pkg/sdkserver/localsdk_test.go @@ -64,9 +64,14 @@ func TestLocal(t *testing.T) { gs, err := l.GetGameServer(ctx, e) assert.Nil(t, err) - assert.Equal(t, defaultGs().GetObjectMeta(), gs.GetObjectMeta()) - assert.Equal(t, defaultGs().GetSpec(), gs.GetSpec()) - gsStatus := defaultGs().GetStatus() + defaultGameServer := defaultGs() + // do this to adjust for any time differences. + // we only care about all the other values to be compared. + defaultGameServer.ObjectMeta.CreationTimestamp = gs.GetObjectMeta().CreationTimestamp + + assert.Equal(t, defaultGameServer.GetObjectMeta(), gs.GetObjectMeta()) + assert.Equal(t, defaultGameServer.GetSpec(), gs.GetSpec()) + gsStatus := defaultGameServer.GetStatus() gsStatus.State = "Shutdown" assert.Equal(t, gsStatus, gs.GetStatus()) }