Skip to content

Commit

Permalink
add shutdown that asserts if headscale had panics (#2126)
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
  • Loading branch information
kradalby authored Sep 17, 2024
1 parent 6cbbcd8 commit ed78ecd
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 53 deletions.
16 changes: 8 additions & 8 deletions integration/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func TestACLHostsInNetMapTable(t *testing.T) {
hsic.WithACLPolicy(&testCase.policy),
)
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

allClients, err := scenario.ListTailscaleClients()
assertNoErr(t, err)
Expand Down Expand Up @@ -316,7 +316,7 @@ func TestACLAllowUser80Dst(t *testing.T) {
},
1,
)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

user1Clients, err := scenario.ListTailscaleClients("user1")
assertNoErr(t, err)
Expand Down Expand Up @@ -373,7 +373,7 @@ func TestACLDenyAllPort80(t *testing.T) {
},
4,
)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

allClients, err := scenario.ListTailscaleClients()
assertNoErr(t, err)
Expand Down Expand Up @@ -417,7 +417,7 @@ func TestACLAllowUserDst(t *testing.T) {
},
2,
)
// defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

user1Clients, err := scenario.ListTailscaleClients("user1")
assertNoErr(t, err)
Expand Down Expand Up @@ -473,7 +473,7 @@ func TestACLAllowStarDst(t *testing.T) {
},
2,
)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

user1Clients, err := scenario.ListTailscaleClients("user1")
assertNoErr(t, err)
Expand Down Expand Up @@ -534,7 +534,7 @@ func TestACLNamedHostsCanReachBySubnet(t *testing.T) {
},
3,
)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

user1Clients, err := scenario.ListTailscaleClients("user1")
assertNoErr(t, err)
Expand Down Expand Up @@ -672,7 +672,7 @@ func TestACLNamedHostsCanReach(t *testing.T) {
&testCase.policy,
2,
)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

// Since user/users dont matter here, we basically expect that some clients
// will be assigned these ips and that we can pick them up for our own use.
Expand Down Expand Up @@ -1021,7 +1021,7 @@ func TestPolicyUpdateWhileRunningWithCLIInDatabase(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": 1,
Expand Down
4 changes: 2 additions & 2 deletions integration/auth_oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestOIDCAuthenticationPingAll(t *testing.T) {
scenario := AuthOIDCScenario{
Scenario: baseScenario,
}
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestOIDCExpireNodesBasedOnTokenExpiry(t *testing.T) {
scenario := AuthOIDCScenario{
Scenario: baseScenario,
}
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": 3,
Expand Down
4 changes: 2 additions & 2 deletions integration/auth_web_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestAuthWebFlowAuthenticationPingAll(t *testing.T) {
scenario := AuthWebFlowScenario{
Scenario: baseScenario,
}
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down Expand Up @@ -73,7 +73,7 @@ func TestAuthWebFlowLogoutAndRelogin(t *testing.T) {
scenario := AuthWebFlowScenario{
Scenario: baseScenario,
}
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down
30 changes: 15 additions & 15 deletions integration/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestUserCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": 0,
Expand Down Expand Up @@ -115,7 +115,7 @@ func TestPreAuthKeyCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
user: 0,
Expand Down Expand Up @@ -257,7 +257,7 @@ func TestPreAuthKeyCommandWithoutExpiry(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
user: 0,
Expand Down Expand Up @@ -320,7 +320,7 @@ func TestPreAuthKeyCommandReusableEphemeral(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
user: 0,
Expand Down Expand Up @@ -398,7 +398,7 @@ func TestPreAuthKeyCorrectUserLoggedInCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
user1: 1,
Expand Down Expand Up @@ -492,7 +492,7 @@ func TestApiKeyCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": 0,
Expand Down Expand Up @@ -660,7 +660,7 @@ func TestNodeTagCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": 0,
Expand Down Expand Up @@ -785,7 +785,7 @@ func TestNodeAdvertiseTagNoACLCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": 1,
Expand Down Expand Up @@ -835,7 +835,7 @@ func TestNodeAdvertiseTagWithACLCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": 1,
Expand Down Expand Up @@ -898,7 +898,7 @@ func TestNodeCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"node-user": 0,
Expand Down Expand Up @@ -1139,7 +1139,7 @@ func TestNodeExpireCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"node-expire-user": 0,
Expand Down Expand Up @@ -1266,7 +1266,7 @@ func TestNodeRenameCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"node-rename-command": 0,
Expand Down Expand Up @@ -1432,7 +1432,7 @@ func TestNodeMoveCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"old-user": 0,
Expand Down Expand Up @@ -1593,7 +1593,7 @@ func TestPolicyCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"policy-user": 0,
Expand Down Expand Up @@ -1673,7 +1673,7 @@ func TestPolicyBrokenConfigCommand(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"policy-user": 1,
Expand Down
4 changes: 2 additions & 2 deletions integration/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestResolveMagicDNS(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"magicdns1": len(MustTestVersions),
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestValidateResolvConf(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"resolvconf1": 3,
Expand Down
2 changes: 1 addition & 1 deletion integration/embedded_derp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestDERPServerScenario(t *testing.T) {
Scenario: baseScenario,
tsicNetworks: map[string]*dockertest.Network{},
}
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down
20 changes: 10 additions & 10 deletions integration/general_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestPingAllByIP(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

// TODO(kradalby): it does not look like the user thing works, only second
// get created? maybe only when many?
Expand Down Expand Up @@ -71,7 +71,7 @@ func TestPingAllByIPPublicDERP(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestAuthKeyLogoutAndRelogin(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down Expand Up @@ -228,7 +228,7 @@ func testEphemeralWithOptions(t *testing.T, opts ...hsic.Option) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down Expand Up @@ -313,7 +313,7 @@ func TestEphemeral2006DeletedTooQuickly(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down Expand Up @@ -427,7 +427,7 @@ func TestPingAllByHostname(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user3": len(MustTestVersions),
Expand Down Expand Up @@ -476,7 +476,7 @@ func TestTaildrop(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"taildrop": len(MustTestVersions),
Expand Down Expand Up @@ -637,7 +637,7 @@ func TestExpireNode(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down Expand Up @@ -763,7 +763,7 @@ func TestNodeOnlineStatus(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

spec := map[string]int{
"user1": len(MustTestVersions),
Expand Down Expand Up @@ -878,7 +878,7 @@ func TestPingAllByIPManyUpDown(t *testing.T) {

scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err)
defer scenario.Shutdown()
defer scenario.ShutdownAssertNoPanics(t)

// TODO(kradalby): it does not look like the user thing works, only second
// get created? maybe only when many?
Expand Down
Loading

0 comments on commit ed78ecd

Please sign in to comment.