diff --git a/example/scalars/scalar_test.go b/example/scalars/scalar_test.go index 34416ad92cf..65cf589a3f1 100644 --- a/example/scalars/scalar_test.go +++ b/example/scalars/scalar_test.go @@ -41,7 +41,9 @@ func TestScalars(t *testing.T) { fragment UserData on User { id name created tier address { location } }`, &resp) require.Equal(t, "1,2", resp.User.Address.Location) - require.Equal(t, time.Now().Unix(), resp.User.Created) + // There can be a delay between creation and test assertion, so we + // give some leeway to eliminate false positives.S + require.WithinDuration(t, time.Now(), time.Unix(resp.User.Created, 0), 5*time.Second) require.Equal(t, "6,66", resp.Search[0].Address.Location) require.Equal(t, int64(666), resp.Search[0].Created) require.Equal(t, "A", resp.Search[0].Tier)