mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
Expose and use ports consistently
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
ed2236aa24
commit
a846e13c78
3 changed files with 13 additions and 2 deletions
|
@ -13,6 +13,7 @@ import (
|
||||||
|
|
||||||
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
||||||
"github.com/ory/dockertest/v3"
|
"github.com/ory/dockertest/v3"
|
||||||
|
"github.com/ory/dockertest/v3/docker"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
)
|
)
|
||||||
|
@ -63,6 +64,10 @@ func (s *IntegrationCLITestSuite) SetupTest() {
|
||||||
Mounts: []string{
|
Mounts: []string{
|
||||||
fmt.Sprintf("%s/integration_test/etc:/etc/headscale", currentPath),
|
fmt.Sprintf("%s/integration_test/etc:/etc/headscale", currentPath),
|
||||||
},
|
},
|
||||||
|
ExposedPorts: []string{"8080/tcp"},
|
||||||
|
PortBindings: map[docker.Port][]docker.PortBinding{
|
||||||
|
"8080/tcp": {{HostPort: "8080"}},
|
||||||
|
},
|
||||||
Networks: []*dockertest.Network{&s.network},
|
Networks: []*dockertest.Network{&s.network},
|
||||||
Cmd: []string{"headscale", "serve"},
|
Cmd: []string{"headscale", "serve"},
|
||||||
}
|
}
|
||||||
|
@ -87,7 +92,9 @@ func (s *IntegrationCLITestSuite) SetupTest() {
|
||||||
fmt.Println("Created headscale container for CLI tests")
|
fmt.Println("Created headscale container for CLI tests")
|
||||||
|
|
||||||
fmt.Println("Waiting for headscale to be ready for CLI tests")
|
fmt.Println("Waiting for headscale to be ready for CLI tests")
|
||||||
hostEndpoint := fmt.Sprintf("localhost:%s", s.headscale.GetPort("8080/tcp"))
|
hostEndpoint := fmt.Sprintf("%s:%s",
|
||||||
|
s.headscale.GetIPInNetwork(&s.network),
|
||||||
|
s.headscale.GetPort("8080/tcp"))
|
||||||
|
|
||||||
if err := s.pool.Retry(func() error {
|
if err := s.pool.Retry(func() error {
|
||||||
url := fmt.Sprintf("http://%s/health", hostEndpoint)
|
url := fmt.Sprintf("http://%s/health", hostEndpoint)
|
||||||
|
|
|
@ -189,6 +189,10 @@ func (s *IntegrationTestSuite) tailscaleContainer(
|
||||||
Cmd: []string{
|
Cmd: []string{
|
||||||
"tailscaled", "--tun=tsdev",
|
"tailscaled", "--tun=tsdev",
|
||||||
},
|
},
|
||||||
|
ExposedPorts: []string{"8080/tcp"},
|
||||||
|
PortBindings: map[docker.Port][]docker.PortBinding{
|
||||||
|
"8080/tcp": {{HostPort: "8080"}},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
err := s.pool.RemoveContainerByName(hostname)
|
err := s.pool.RemoveContainerByName(hostname)
|
||||||
|
|
|
@ -109,10 +109,10 @@ func (s *IntegrationOIDCTestSuite) SetupSuite() {
|
||||||
Name: oidcMockHostname,
|
Name: oidcMockHostname,
|
||||||
Cmd: []string{"headscale", "mockoidc"},
|
Cmd: []string{"headscale", "mockoidc"},
|
||||||
ExposedPorts: []string{"10000/tcp"},
|
ExposedPorts: []string{"10000/tcp"},
|
||||||
Networks: []*dockertest.Network{&s.network},
|
|
||||||
PortBindings: map[docker.Port][]docker.PortBinding{
|
PortBindings: map[docker.Port][]docker.PortBinding{
|
||||||
"10000/tcp": {{HostPort: "10000"}},
|
"10000/tcp": {{HostPort: "10000"}},
|
||||||
},
|
},
|
||||||
|
Networks: []*dockertest.Network{&s.network},
|
||||||
Env: []string{
|
Env: []string{
|
||||||
fmt.Sprintf("MOCKOIDC_ADDR=%s", oidcMockHostname),
|
fmt.Sprintf("MOCKOIDC_ADDR=%s", oidcMockHostname),
|
||||||
"MOCKOIDC_PORT=10000",
|
"MOCKOIDC_PORT=10000",
|
||||||
|
|
Loading…
Reference in a new issue