Remove docker network, it wasnt used, comment out portmapping to host

This commit is contained in:
Kristoffer Dalby 2021-10-04 14:15:20 +01:00
parent 31b4f03f96
commit 2090a13dcd
No known key found for this signature in database
GPG Key ID: 09F62DC067465735

View File

@ -35,7 +35,6 @@ var (
var (
pool dockertest.Pool
network dockertest.Network
headscale dockertest.Resource
)
@ -89,10 +88,6 @@ func TestIntegrationTestSuite(t *testing.T) {
if err := pool.Purge(&headscale); err != nil {
log.Printf("Could not purge resource: %s\n", err)
}
if err := network.Close(); err != nil {
log.Printf("Could not close network: %s\n", err)
}
}
func executeCommand(resource *dockertest.Resource, cmd []string, env []string) (string, error) {
@ -184,9 +179,8 @@ func tailscaleContainer(namespace, identifier, version string) (string, *dockert
}
hostname := fmt.Sprintf("%s-tailscale-%s-%s", namespace, strings.Replace(version, ".", "-", -1), identifier)
tailscaleOptions := &dockertest.RunOptions{
Name: hostname,
Networks: []*dockertest.Network{&network},
Cmd: []string{"tailscaled", "--tun=userspace-networking", "--socks5-server=localhost:1055"},
Name: hostname,
Cmd: []string{"tailscaled", "--tun=userspace-networking", "--socks5-server=localhost:1055"},
}
pts, err := pool.BuildAndRunWithBuildOptions(tailscaleBuildOptions, tailscaleOptions, dockerRestartPolicy)
@ -210,12 +204,6 @@ func (s *IntegrationTestSuite) SetupSuite() {
log.Fatalf("Could not connect to docker: %s", err)
}
if pnetwork, err := pool.CreateNetwork("headscale-test"); err == nil {
network = *pnetwork
} else {
log.Fatalf("Could not create network: %s", err)
}
headscaleBuildOptions := &dockertest.BuildOptions{
Dockerfile: "Dockerfile",
ContextDir: ".",
@ -232,11 +220,10 @@ func (s *IntegrationTestSuite) SetupSuite() {
fmt.Sprintf("%s/integration_test/etc:/etc/headscale", currentPath),
fmt.Sprintf("%s/derp.yaml:/etc/headscale/derp.yaml", currentPath),
},
Networks: []*dockertest.Network{&network},
Cmd: []string{"headscale", "serve"},
PortBindings: map[docker.Port][]docker.PortBinding{
"8080/tcp": {{HostPort: "8080"}},
},
Cmd: []string{"headscale", "serve"},
// PortBindings: map[docker.Port][]docker.PortBinding{
// "8080/tcp": {{HostPort: "8080"}},
// },
}
fmt.Println("Creating headscale container")