mirror of
https://github.com/juanfont/headscale.git
synced 2025-05-23 01:15:27 +02:00
panic if no networks are set
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
9001707d44
commit
5f8b3b8072
@ -135,6 +135,9 @@ func (s *Scenario) AddNetwork(name string) (*dockertest.Network, error) {
|
||||
}
|
||||
|
||||
func (s *Scenario) Networks() []*dockertest.Network {
|
||||
if len(s.networks) == 0 {
|
||||
panic("Scenario.Networks called with empty network list")
|
||||
}
|
||||
return xmaps.Values(s.networks)
|
||||
}
|
||||
|
||||
|
@ -68,38 +68,6 @@ func TestHeadscale(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// If subtests are parallel, then they will start before setup is run.
|
||||
// This might mean we approach setup slightly wrong, but for now, ignore
|
||||
// the linter
|
||||
// nolint:tparallel
|
||||
func TestCreateTailscale(t *testing.T) {
|
||||
IntegrationSkip(t)
|
||||
t.Parallel()
|
||||
|
||||
user := "only-create-containers"
|
||||
|
||||
scenario, err := NewScenario(dockertestMaxWait())
|
||||
assertNoErr(t, err)
|
||||
defer scenario.ShutdownAssertNoPanics(t)
|
||||
|
||||
scenario.users[user] = &User{
|
||||
Clients: make(map[string]TailscaleClient),
|
||||
}
|
||||
|
||||
t.Run("create-tailscale", func(t *testing.T) {
|
||||
err := scenario.CreateTailscaleNodesInUser(user, "all", 3)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to add tailscale nodes: %s", err)
|
||||
}
|
||||
|
||||
if clients := len(scenario.users[user].Clients); clients != 3 {
|
||||
t.Fatalf("wrong number of tailscale clients: %d != %d", clients, 3)
|
||||
}
|
||||
|
||||
// TODO(kradalby): Test "all" version logic
|
||||
})
|
||||
}
|
||||
|
||||
// If subtests are parallel, then they will start before setup is run.
|
||||
// This might mean we approach setup slightly wrong, but for now, ignore
|
||||
// the linter
|
||||
|
Loading…
Reference in New Issue
Block a user