Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for flaky TestSDKSetAnnotation #516

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions test/e2e/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ func TestSDKSetLabel(t *testing.T) {
func TestSDKSetAnnotation(t *testing.T) {
t.Parallel()
gs := defaultGameServer()
annotation := "stable.agones.dev/sdk-timestamp"
readyGs, err := framework.CreateGameServerAndWaitUntilReady(defaultNs, gs)
if err != nil {
t.Fatalf("Could not get a GameServer ready: %v", err)
}
defer framework.AgonesClient.StableV1alpha1().GameServers(defaultNs).Delete(readyGs.ObjectMeta.Name, nil) // nolint: errcheck

assert.Equal(t, readyGs.Status.State, v1alpha1.GameServerStateReady)
reply, err := e2eframework.PingGameServer("ANNOTATION", fmt.Sprintf("%s:%d", readyGs.Status.Address,
Expand All @@ -109,12 +111,13 @@ func TestSDKSetAnnotation(t *testing.T) {
if err != nil {
return true, err
}
return gs.ObjectMeta.Annotations != nil, nil

_, ok := gs.ObjectMeta.Annotations[annotation]
return ok, nil
})

assert.Nil(t, err)
assert.NotEmpty(t, gs.ObjectMeta.Annotations["stable.agones.dev/sdk-timestamp"])

assert.NotEmpty(t, gs.ObjectMeta.Annotations[annotation])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I distinctly remember seeing failures where "sdk-timestamp" was set but version was not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try:

go test -count=100 -timeout 90s agones.dev/agones/test/e2e -run TestSDKSetAnnotation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be strange, as the version annotation is set via a mutation webhook.

Ran this 50 times (in batches to fit under the timeout - also added a defer to delete the gameserver), no errors 🤷‍♂️

(Nice trick with -count=100 didn't know that one, will steal it 👍 )

assert.NotEmpty(t, gs.ObjectMeta.Annotations[stable.VersionAnnotation])
}

Expand Down