Skip to content

Commit

Permalink
Remove unused function FindGameServerContainer (#3841)
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerlynn authored May 30, 2024
1 parent 4b2910b commit 138551e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
7 changes: 0 additions & 7 deletions pkg/apis/agones/v1/gameserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,6 @@ func (gss *GameServerSpec) FindContainer(name string) (int, corev1.Container, er
return -1, corev1.Container{}, errors.Errorf("Could not find a container named %s", name)
}

// FindGameServerContainer returns the container that is specified in
// gameServer.Spec.Container. Returns the index and the value.
// Returns an error if not found
func (gs *GameServer) FindGameServerContainer() (int, corev1.Container, error) {
return gs.Spec.FindContainer(gs.Spec.Container)
}

// ApplyToPodContainer applies func(v1.Container) to the specified container in the pod.
// Returns an error if the container is not found.
func (gs *GameServer) ApplyToPodContainer(pod *corev1.Pod, containerName string, f func(corev1.Container) corev1.Container) error {
Expand Down
26 changes: 0 additions & 26 deletions pkg/apis/agones/v1/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,32 +140,6 @@ func TestIsBeingDeleted(t *testing.T) {
}
}

func TestGameServerFindGameServerContainer(t *testing.T) {
t.Parallel()

fixture := corev1.Container{Name: "mycontainer", Image: "foo/mycontainer"}
gs := &GameServer{
Spec: GameServerSpec{
Container: "mycontainer",
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
fixture,
{Name: "notmycontainer", Image: "foo/notmycontainer"},
},
},
},
},
}

i, container, err := gs.FindGameServerContainer()
assert.Nil(t, err)
assert.Equal(t, fixture, container)
container.Ports = append(container.Ports, corev1.ContainerPort{HostPort: 1234})
gs.Spec.Template.Spec.Containers[i] = container
assert.Equal(t, gs.Spec.Template.Spec.Containers[0], container)
}

func TestGameServerApplyDefaults(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 138551e

Please sign in to comment.