Skip to content

Commit

Permalink
Test SuperTuxKart Image (#3496)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalaiselvi84 authored Nov 9, 2023
1 parent 3c3af17 commit a92303b
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions test/e2e/examples_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2023 Google LLC All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e

import (
"testing"

agonesv1 "agones.dev/agones/pkg/apis/agones/v1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestSuperTuxKartGameServerReady(t *testing.T) {
t.Parallel()
gs := &agonesv1.GameServer{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "supertuxkart-",
},
Spec: agonesv1.GameServerSpec{
Container: "supertuxkart",
Ports: []agonesv1.GameServerPort{{
ContainerPort: 8080,
Name: "default",
PortPolicy: agonesv1.Dynamic,
Protocol: corev1.ProtocolUDP,
}},
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "supertuxkart",
Image: "us-docker.pkg.dev/agones-images/examples/supertuxkart-example:0.10",
Env: []corev1.EnvVar{
{
Name: "ENABLE_PLAYER_TRACKING",
Value: "false",
},
},
},
},
},
},
},
}

// 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 a92303b

Please sign in to comment.