Skip to content

Commit

Permalink
Merge pull request #7946 from sbueringer/pr-test-e2e-dont-restart-con…
Browse files Browse the repository at this point in the history
…formance-image

🐛 test/e2e: don't restart the conformance test container after ginkgo exits
  • Loading branch information
k8s-ci-robot committed Jan 19, 2023
2 parents e274f44 + 6fdd6a3 commit f7bba22
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/framework/kubetest/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ func Run(ctx context.Context, input RunInput) error {
EnvironmentVars: env,
CommandArgs: args,
Entrypoint: []string{"/usr/local/bin/ginkgo"},
// We don't want the conformance test container to restart once ginkgo exits.
RestartPolicy: "no",
}, ginkgo.GinkgoWriter)
if err != nil {
return errors.Wrap(err, "Unable to run conformance tests")
Expand Down
7 changes: 6 additions & 1 deletion test/infrastructure/container/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ func (d *dockerRuntime) RunContainer(ctx context.Context, runConfig *RunContaine
Volumes: map[string]struct{}{},
}

restartPolicy := runConfig.RestartPolicy
if restartPolicy == "" {
restartPolicy = "unless-stopped"
}

hostConfig := dockercontainer.HostConfig{
// Running containers in a container requires privileges.
// NOTE: we could try to replicate this with --cap-add, and use less
Expand All @@ -383,7 +388,7 @@ func (d *dockerRuntime) RunContainer(ctx context.Context, runConfig *RunContaine
NetworkMode: dockercontainer.NetworkMode(runConfig.Network),
Tmpfs: runConfig.Tmpfs,
PortBindings: nat.PortMap{},
RestartPolicy: dockercontainer.RestartPolicy{Name: "unless-stopped"},
RestartPolicy: dockercontainer.RestartPolicy{Name: restartPolicy},
}
networkConfig := network.NetworkingConfig{}

Expand Down
3 changes: 3 additions & 0 deletions test/infrastructure/container/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ type RunContainerInput struct {
PortMappings []PortMapping
// IPFamily is the IP version to use.
IPFamily clusterv1.ClusterIPFamily
// RestartPolicy to use for the container.
// If not set, defaults to "unless-stopped".
RestartPolicy string
}

// ExecContainerInput contains values for running exec on a container.
Expand Down

0 comments on commit f7bba22

Please sign in to comment.