From 5f8b3b8072aa75ebaa451f12cd5507c3a2db7816 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 10 Mar 2025 16:22:58 +0100 Subject: [PATCH] panic if no networks are set Signed-off-by: Kristoffer Dalby --- integration/scenario.go | 3 +++ integration/scenario_test.go | 32 -------------------------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/integration/scenario.go b/integration/scenario.go index c8d3e850..018bdf96 100644 --- a/integration/scenario.go +++ b/integration/scenario.go @@ -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) } diff --git a/integration/scenario_test.go b/integration/scenario_test.go index aec6cb5c..27da5ae1 100644 --- a/integration/scenario_test.go +++ b/integration/scenario_test.go @@ -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