diff --git a/hscontrol/mapper/batcher_test.go b/hscontrol/mapper/batcher_test.go index 1dac3705..0fe1266d 100644 --- a/hscontrol/mapper/batcher_test.go +++ b/hscontrol/mapper/batcher_test.go @@ -36,6 +36,7 @@ type batcherTestCase struct { // that would normally be sent by poll.go in production. type testBatcherWrapper struct { Batcher + state *state.State } @@ -81,12 +82,7 @@ func (t *testBatcherWrapper) RemoveNode(id types.NodeID, c chan<- *tailcfg.MapRe } // Finally remove from the real batcher - removed := t.Batcher.RemoveNode(id, c) - if !removed { - return false - } - - return true + return t.Batcher.RemoveNode(id, c) } // wrapBatcherForTest wraps a batcher with test-specific behavior. diff --git a/hscontrol/policy/v2/types.go b/hscontrol/policy/v2/types.go index c99f1156..41e7e0d9 100644 --- a/hscontrol/policy/v2/types.go +++ b/hscontrol/policy/v2/types.go @@ -596,6 +596,7 @@ type Alias interface { type AliasWithPorts struct { Alias + Ports []tailcfg.PortRange } @@ -2107,7 +2108,7 @@ func validateProtocolPortCompatibility(protocol Protocol, destinations []AliasWi for _, dst := range destinations { for _, portRange := range dst.Ports { // Check if it's not a wildcard port (0-65535) - if !(portRange.First == 0 && portRange.Last == 65535) { + if portRange.First != 0 || portRange.Last != 65535 { return fmt.Errorf("protocol %q does not support specific ports; only \"*\" is allowed", protocol) } } diff --git a/hscontrol/util/util_test.go b/hscontrol/util/util_test.go index a064a852..ec72250e 100644 --- a/hscontrol/util/util_test.go +++ b/hscontrol/util/util_test.go @@ -1103,7 +1103,7 @@ func TestEnsureHostnameWithHostinfo(t *testing.T) { wantHostname: "test-node", checkHostinfo: func(t *testing.T, hi *tailcfg.Hostinfo) { if hi == nil { - t.Error("hostinfo should not be nil") + t.Fatal("hostinfo should not be nil") } if hi.Hostname != "test-node" { @@ -1149,7 +1149,7 @@ func TestEnsureHostnameWithHostinfo(t *testing.T) { wantHostname: "node-nkey1234", checkHostinfo: func(t *testing.T, hi *tailcfg.Hostinfo) { if hi == nil { - t.Error("hostinfo should not be nil") + t.Fatal("hostinfo should not be nil") } if hi.Hostname != "node-nkey1234" { @@ -1165,7 +1165,7 @@ func TestEnsureHostnameWithHostinfo(t *testing.T) { wantHostname: "unknown-node", checkHostinfo: func(t *testing.T, hi *tailcfg.Hostinfo) { if hi == nil { - t.Error("hostinfo should not be nil") + t.Fatal("hostinfo should not be nil") } if hi.Hostname != "unknown-node" { @@ -1183,7 +1183,7 @@ func TestEnsureHostnameWithHostinfo(t *testing.T) { wantHostname: "unknown-node", checkHostinfo: func(t *testing.T, hi *tailcfg.Hostinfo) { if hi == nil { - t.Error("hostinfo should not be nil") + t.Fatal("hostinfo should not be nil") } if hi.Hostname != "unknown-node" { diff --git a/integration/auth_oidc_test.go b/integration/auth_oidc_test.go index 18c5c3a9..bdd5bce2 100644 --- a/integration/auth_oidc_test.go +++ b/integration/auth_oidc_test.go @@ -1052,7 +1052,7 @@ func TestOIDCMultipleOpenedLoginUrls(t *testing.T) { require.NotEqual(t, redirect1.String(), redirect2.String()) // complete auth with the first opened "browser tab" - _, redirect1, err = doLoginURLWithClient(ts.Hostname(), redirect1, loginClient, true) + _, _, err = doLoginURLWithClient(ts.Hostname(), redirect1, loginClient, true) require.NoError(t, err) listUsers, err = headscale.ListUsers() diff --git a/integration/hsic/hsic.go b/integration/hsic/hsic.go index a08ee7af..c4eaeea8 100644 --- a/integration/hsic/hsic.go +++ b/integration/hsic/hsic.go @@ -721,8 +721,6 @@ func extractTarToDirectory(tarData []byte, targetDir string) error { return fmt.Errorf("failed to create directory %s: %w", targetDir, err) } - tarReader := tar.NewReader(bytes.NewReader(tarData)) - // Find the top-level directory to strip var topLevelDir string @@ -743,7 +741,7 @@ func extractTarToDirectory(tarData []byte, targetDir string) error { } } - tarReader = tar.NewReader(bytes.NewReader(tarData)) + tarReader := tar.NewReader(bytes.NewReader(tarData)) for { header, err := tarReader.Next() if err == io.EOF {