Skip to content

Commit

Permalink
adjustments to oidc tests
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Aug 31, 2023
1 parent 8c5bf7a commit 6b1f6d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
14 changes: 1 addition & 13 deletions integration/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func aclScenario(
t *testing.T,
policy *policy.ACLPolicy,
clientsPerUser int,
peerCount *int,
) *Scenario {
t.Helper()
scenario, err := NewScenario()
Expand All @@ -74,11 +73,6 @@ func aclScenario(
)
assertNoErr(t, err)

if peerCount != nil {
err = scenario.WaitForTailscaleSyncWithPeerCount(*peerCount)
assertNoErrSync(t, err)
}

_, err = scenario.ListTailscaleClientsFQDNs()
assertNoErrListFQDN(t, err)

Expand Down Expand Up @@ -315,7 +309,6 @@ func TestACLAllowUser80Dst(t *testing.T) {
},
},
1,
nil,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -373,7 +366,6 @@ func TestACLDenyAllPort80(t *testing.T) {
},
},
4,
nil,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -418,7 +410,6 @@ func TestACLAllowUserDst(t *testing.T) {
},
},
2,
nil,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -475,7 +466,6 @@ func TestACLAllowStarDst(t *testing.T) {
},
},
2,
nil,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -537,7 +527,6 @@ func TestACLNamedHostsCanReachBySubnet(t *testing.T) {
},
},
3,
nil,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -676,7 +665,6 @@ func TestACLNamedHostsCanReach(t *testing.T) {
scenario := aclScenario(t,
&testCase.policy,
2,
nil,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -946,7 +934,7 @@ func TestACLDevice1CanAccessDevice2(t *testing.T) {

for name, testCase := range tests {
t.Run(name, func(t *testing.T) {
scenario := aclScenario(t, &testCase.policy, 1, nil)
scenario := aclScenario(t, &testCase.policy, 1)

test1ip := netip.MustParseAddr("100.64.0.1")
test1ip6 := netip.MustParseAddr("fd7a:115c:a1e0::1")
Expand Down
8 changes: 6 additions & 2 deletions integration/auth_oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (s *AuthOIDCScenario) runTailscaleUp(
user.joinWaitGroup.Go(func() error {
loginURL, err := c.LoginWithURL(loginServer)
if err != nil {
log.Printf("failed to run tailscale up: %s", err)
log.Printf("%s failed to run tailscale up: %s", c.Hostname(), err)
}

loginURL.Host = fmt.Sprintf("%s:8080", headscale.GetIP())
Expand Down Expand Up @@ -335,7 +335,11 @@ func (s *AuthOIDCScenario) runTailscaleUp(
for _, client := range user.Clients {
err := client.WaitForRunning()
if err != nil {
return fmt.Errorf("%s failed to up tailscale node: %w", client.Hostname(), err)
return fmt.Errorf(
"%s tailscale node has not reached running: %w",
client.Hostname(),
err,
)
}
}

Expand Down
8 changes: 2 additions & 6 deletions integration/tsic/tsic.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,6 @@ func (t *TailscaleInContainer) WaitForRunning() error {
return errTailscaleStatus(t.hostname, err)
}

if status.CurrentTailnet != nil {
return nil
}

// ipnstate.Status.CurrentTailnet was added in Tailscale 1.22.0
// https://github.com/tailscale/tailscale/pull/3865
//
Expand All @@ -519,7 +515,7 @@ func (t *TailscaleInContainer) WaitForRunning() error {

// WaitForLogout blocks until the Tailscale instance has logged out.
func (t *TailscaleInContainer) WaitForLogout() error {
return t.pool.Retry(func() error {
return fmt.Errorf("%s err: %w", t.hostname, t.pool.Retry(func() error {
status, err := t.Status()
if err != nil {
return errTailscaleStatus(t.hostname, err)
Expand All @@ -530,7 +526,7 @@ func (t *TailscaleInContainer) WaitForLogout() error {
}

return errTailscaleNotLoggedOut
})
}))
}

// WaitForPeers blocks until N number of peers is present in the
Expand Down

0 comments on commit 6b1f6d4

Please sign in to comment.