summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extras/hs-test/docker/Dockerfile.nginx-server2
-rw-r--r--extras/hs-test/infra/container.go25
2 files changed, 25 insertions, 2 deletions
diff --git a/extras/hs-test/docker/Dockerfile.nginx-server b/extras/hs-test/docker/Dockerfile.nginx-server
index 1971158131b..0720c6f2cb7 100644
--- a/extras/hs-test/docker/Dockerfile.nginx-server
+++ b/extras/hs-test/docker/Dockerfile.nginx-server
@@ -9,4 +9,4 @@ RUN apt-get update \
COPY resources/nginx/nginx_server_mirroring.conf /nginx.conf
-ENTRYPOINT ["nginx", "-c", "/nginx.conf"]
+ENTRYPOINT nginx -c /nginx.conf
diff --git a/extras/hs-test/infra/container.go b/extras/hs-test/infra/container.go
index 46cee976556..7317499b15f 100644
--- a/extras/hs-test/infra/container.go
+++ b/extras/hs-test/infra/container.go
@@ -14,6 +14,7 @@ import (
"time"
containerTypes "github.com/docker/docker/api/types/container"
+ "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/pkg/stdcopy"
"github.com/edwarnicke/exechelper"
@@ -179,6 +180,7 @@ func (c *Container) Create() error {
resp, err := c.Suite.Docker.ContainerCreate(
c.ctx,
&containerTypes.Config{
+ Hostname: c.Name,
Image: c.Image,
Env: c.getEnvVars(),
Cmd: strings.Split(c.ExtraRunningArgs, " "),
@@ -216,7 +218,9 @@ func (c *Container) allocateCpus() {
// Starts a container
func (c *Container) Start() error {
var err error
- for nTries := 0; nTries < 5; nTries++ {
+ var nTries int
+
+ for nTries = 0; nTries < 5; nTries++ {
err = c.Suite.Docker.ContainerStart(c.ctx, c.ID, containerTypes.StartOptions{})
if err == nil {
continue
@@ -224,6 +228,25 @@ func (c *Container) Start() error {
c.Suite.Log("Error while starting " + c.Name + ". Retrying...")
time.Sleep(1 * time.Second)
}
+ if nTries >= 5 {
+ return err
+ }
+
+ // wait for container to start
+ time.Sleep(1 * time.Second)
+
+ // check if container exited right after startup
+ containers, err := c.Suite.Docker.ContainerList(c.ctx, containerTypes.ListOptions{
+ All: true,
+ Filters: filters.NewArgs(filters.Arg("name", c.Name)),
+ })
+ if err != nil {
+ return err
+ }
+ if containers[0].State == "exited" {
+ c.Suite.Log("Container details: " + fmt.Sprint(containers[0]))
+ return fmt.Errorf("Container %s exited: '%s'", c.Name, containers[0].Status)
+ }
return err
}