Add web server to dev image

This commit is contained in:
Arthur Barr
2018-03-12 11:14:59 +00:00
parent 104098c7b4
commit 10e448056b
19 changed files with 621 additions and 20 deletions

View File

@@ -39,6 +39,7 @@ import (
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/go-connections/nat"
)
func imageName() string {
@@ -166,6 +167,15 @@ func runContainer(t *testing.T, cli *client.Client, containerConfig *container.C
coverageBind(t),
terminationBind(t),
},
// Assign a random port for the web server on the host
// TODO: Don't do this for all tests
PortBindings: nat.PortMap{
"9443/tcp": []nat.PortBinding{
{
HostIP: "0.0.0.0",
},
},
},
}
networkingConfig := network.NetworkingConfig{}
t.Logf("Running container (%s)", containerConfig.Image)
@@ -493,3 +503,11 @@ func copyFromContainer(t *testing.T, cli *client.Client, id string, file string)
}
return b
}
func getWebPort(t *testing.T, cli *client.Client, ID string) string {
i, err := cli.ContainerInspect(context.Background(), ID)
if err != nil {
t.Fatal(err)
}
return i.NetworkSettings.Ports["9443/tcp"][0].HostPort
}