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

Test NodeJS image #3498

Merged
merged 12 commits into from
Nov 14, 2023
54 changes: 46 additions & 8 deletions test/e2e/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ func TestSuperTuxKartGameServerReady(t *testing.T) {
assert.Equal(t, agonesv1.GameServerStateReady, readyGs.Status.State)
}

func TestRustGameServerReady(t *testing.T) {
func TestCppSimpleGameServerReady(t *testing.T) {
t.Parallel()
gs := &agonesv1.GameServer{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "rust-simple-",
GenerateName: "cpp-simple-",
Copy link
Member

Choose a reason for hiding this comment

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

I just noticed this here switched from Rus to CPP - was that deliberate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to keep the e2e tests in the order you mentioned in the ticket - https://buganizer.corp.google.com/issues/309492114#comment1

Copy link
Member

Choose a reason for hiding this comment

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

The order doesn't matter at all. You can revert these changes 👍🏻

},
Spec: agonesv1.GameServerSpec{
Ports: []agonesv1.GameServerPort{{
Expand All @@ -82,8 +82,8 @@ func TestRustGameServerReady(t *testing.T) {
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "rust-simple",
Image: "us-docker.pkg.dev/agones-images/examples/rust-simple-server:0.11",
Name: "cpp-simple",
Image: "us-docker.pkg.dev/agones-images/examples/cpp-simple-server:0.15",
},
},
},
Expand All @@ -99,11 +99,11 @@ func TestRustGameServerReady(t *testing.T) {
assert.Equal(t, agonesv1.GameServerStateReady, readyGs.Status.State)
}

func TestCppSimpleGameServerReady(t *testing.T) {
func TestNodeJSGameServerReady(t *testing.T) {
t.Parallel()
gs := &agonesv1.GameServer{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "cpp-simple-",
GenerateName: "nodejs-simple-",
},
Spec: agonesv1.GameServerSpec{
Ports: []agonesv1.GameServerPort{{
Expand All @@ -112,12 +112,50 @@ func TestCppSimpleGameServerReady(t *testing.T) {
ContainerPort: 7654,
Protocol: corev1.ProtocolUDP,
}},
Health: agonesv1.Health{
InitialDelaySeconds: 300,
markmandel marked this conversation as resolved.
Show resolved Hide resolved
PeriodSeconds: 25,
},
Copy link
Member

Choose a reason for hiding this comment

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

Can you do me a favour - can we remove the Health settings, and we can test without it?

Suggested change
Health: agonesv1.Health{
InitialDelaySeconds: 300,
PeriodSeconds: 25,
},

We shouldn't have to make them so long now, since it looks like it was a resource setting issue that we fixed below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing this health settings indicated that the GameServer reached a terminal 'Unhealthy' state upon testing- https://gist.github.com/Kalaiselvi84/8d7a212a93c04291d42f90476c0fcb7f

Copy link
Member

Choose a reason for hiding this comment

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

Even with the resource settings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! it fails with resource and without health.

Copy link
Member

Choose a reason for hiding this comment

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

Oh yeah it would! Because it does't make health calls very often!

Okay, let's try a small number - probably:

			Health: agonesv1.Health{
				InitialDelaySeconds: 30,
				PeriodSeconds:       30,
			},

Should be a good fit.

Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "cpp-simple",
Image: "us-docker.pkg.dev/agones-images/examples/cpp-simple-server:0.15",
Name: "nodejs-simple",
Image: "us-docker.pkg.dev/agones-images/examples/nodejs-simple-server:0.9",
},
},
},
},
},
}

// Use the e2e framework's function to create the GameServer and wait until it's ready
readyGs, err := framework.CreateGameServerAndWaitUntilReady(t, framework.Namespace, gs)
require.NoError(t, err)

// Assert that the GameServer is in the expected state
assert.Equal(t, agonesv1.GameServerStateReady, readyGs.Status.State)
}

func TestRustGameServerReady(t *testing.T) {
t.Parallel()
gs := &agonesv1.GameServer{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "rust-simple-",
},
Spec: agonesv1.GameServerSpec{
Ports: []agonesv1.GameServerPort{{
Name: "default",
PortPolicy: agonesv1.Dynamic,
ContainerPort: 7654,
Protocol: corev1.ProtocolUDP,
}},
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "rust-simple",
Image: "us-docker.pkg.dev/agones-images/examples/rust-simple-server:0.11",
},
},
},
Expand Down