Skip to content

Commit

Permalink
xonotic image test (#3494)
Browse files Browse the repository at this point in the history
* xonotic image test
  • Loading branch information
Kalaiselvi84 committed Nov 15, 2023
1 parent 9597660 commit e135abf
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/xonotic/fleet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ spec:
containers:
- name: xonotic
image: us-docker.pkg.dev/agones-images/examples/xonotic-example:1.5
resources:
requests:
memory: 700Mi
cpu: 200m
4 changes: 4 additions & 0 deletions examples/xonotic/gameserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ spec:
containers:
- name: xonotic
image: us-docker.pkg.dev/agones-images/examples/xonotic-example:1.5
resources:
requests:
memory: 700Mi
cpu: 200m
# imagePullPolicy: Always # add for development
46 changes: 46 additions & 0 deletions test/e2e/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,49 @@ func TestNodeJSGameServerReady(t *testing.T) {
// Assert that the GameServer is in the expected state
assert.Equal(t, agonesv1.GameServerStateReady, readyGs.Status.State)
}

func TestXonoticGameServerReady(t *testing.T) {
t.Parallel()
gs := &agonesv1.GameServer{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "xonotic-",
},

Spec: agonesv1.GameServerSpec{
Container: "xonotic",
Ports: []agonesv1.GameServerPort{{
ContainerPort: 26000,
Name: "default",
PortPolicy: agonesv1.Dynamic,
Protocol: corev1.ProtocolUDP,
}},
Health: agonesv1.Health{
InitialDelaySeconds: 60,
PeriodSeconds: 5,
},
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "xonotic",
Image: "us-docker.pkg.dev/agones-images/examples/xonotic-example:1.5",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("700Mi"),
corev1.ResourceCPU: resource.MustParse("200m"),
},
},
},
},
},
},
},
}

// 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)
}

0 comments on commit e135abf

Please sign in to comment.