mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-02 03:33:05 +00:00
Revert "Remove docker network, it wasnt used, comment out portmapping to host"
This reverts commit 2090a13dcd
.
This commit is contained in:
parent
931ef9482b
commit
c09428acca
1 changed files with 19 additions and 6 deletions
|
@ -35,6 +35,7 @@ var (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pool dockertest.Pool
|
pool dockertest.Pool
|
||||||
|
network dockertest.Network
|
||||||
headscale dockertest.Resource
|
headscale dockertest.Resource
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -88,6 +89,10 @@ func TestIntegrationTestSuite(t *testing.T) {
|
||||||
if err := pool.Purge(&headscale); err != nil {
|
if err := pool.Purge(&headscale); err != nil {
|
||||||
log.Printf("Could not purge resource: %s\n", err)
|
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) {
|
func executeCommand(resource *dockertest.Resource, cmd []string, env []string) (string, error) {
|
||||||
|
@ -179,8 +184,9 @@ func tailscaleContainer(namespace, identifier, version string) (string, *dockert
|
||||||
}
|
}
|
||||||
hostname := fmt.Sprintf("%s-tailscale-%s-%s", namespace, strings.Replace(version, ".", "-", -1), identifier)
|
hostname := fmt.Sprintf("%s-tailscale-%s-%s", namespace, strings.Replace(version, ".", "-", -1), identifier)
|
||||||
tailscaleOptions := &dockertest.RunOptions{
|
tailscaleOptions := &dockertest.RunOptions{
|
||||||
Name: hostname,
|
Name: hostname,
|
||||||
Cmd: []string{"tailscaled", "--tun=userspace-networking", "--socks5-server=localhost:1055"},
|
Networks: []*dockertest.Network{&network},
|
||||||
|
Cmd: []string{"tailscaled", "--tun=userspace-networking", "--socks5-server=localhost:1055"},
|
||||||
}
|
}
|
||||||
|
|
||||||
pts, err := pool.BuildAndRunWithBuildOptions(tailscaleBuildOptions, tailscaleOptions, dockerRestartPolicy)
|
pts, err := pool.BuildAndRunWithBuildOptions(tailscaleBuildOptions, tailscaleOptions, dockerRestartPolicy)
|
||||||
|
@ -204,6 +210,12 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
||||||
log.Fatalf("Could not connect to docker: %s", err)
|
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{
|
headscaleBuildOptions := &dockertest.BuildOptions{
|
||||||
Dockerfile: "Dockerfile",
|
Dockerfile: "Dockerfile",
|
||||||
ContextDir: ".",
|
ContextDir: ".",
|
||||||
|
@ -220,10 +232,11 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
||||||
fmt.Sprintf("%s/integration_test/etc:/etc/headscale", currentPath),
|
fmt.Sprintf("%s/integration_test/etc:/etc/headscale", currentPath),
|
||||||
fmt.Sprintf("%s/derp.yaml:/etc/headscale/derp.yaml", currentPath),
|
fmt.Sprintf("%s/derp.yaml:/etc/headscale/derp.yaml", currentPath),
|
||||||
},
|
},
|
||||||
Cmd: []string{"headscale", "serve"},
|
Networks: []*dockertest.Network{&network},
|
||||||
// PortBindings: map[docker.Port][]docker.PortBinding{
|
Cmd: []string{"headscale", "serve"},
|
||||||
// "8080/tcp": {{HostPort: "8080"}},
|
PortBindings: map[docker.Port][]docker.PortBinding{
|
||||||
// },
|
"8080/tcp": {{HostPort: "8080"}},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Creating headscale container")
|
fmt.Println("Creating headscale container")
|
||||||
|
|
Loading…
Reference in a new issue