Add web server to dev image
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user