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

Remove unused function FindGameServerContainer #3841

Merged
Merged
Show file tree
Hide file tree
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
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
Loading