Working on migrate DERP tests to scenarios

This commit is contained in:
Juan Font
2023-04-07 22:06:44 +00:00
parent 353f191e4f
commit b36df48d78
2 changed files with 230 additions and 1 deletions

View File

@@ -52,6 +52,7 @@ type HeadscaleInContainer struct {
// optional config
port int
extraPorts []string
aclPolicy *headscale.ACLPolicy
env map[string]string
tlsCert []byte
@@ -108,6 +109,13 @@ func WithPort(port int) Option {
}
}
// WithExtraPorts exposes additional ports on the container (e.g. 3478/udp for STUN)
func WithExtraPorts(ports []string) Option {
return func(hsic *HeadscaleInContainer) {
hsic.extraPorts = ports
}
}
// WithTestName sets a name for the test, this will be reflected
// in the Docker container name.
func WithTestName(testName string) Option {
@@ -187,7 +195,7 @@ func New(
runOptions := &dockertest.RunOptions{
Name: hsic.hostname,
ExposedPorts: []string{portProto},
ExposedPorts: append([]string{portProto}, hsic.extraPorts...),
Networks: []*dockertest.Network{network},
// Cmd: []string{"headscale", "serve"},
// TODO(kradalby): Get rid of this hack, we currently need to give us some