mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-12 17:59:06 +02:00
[client] Stop the gate test from dialing the real management server
TestLogin_RestatingTheStoredConfigPassesTheGate asserts that the gate lets a no-op login through, and the handler then went on to do the login for real: isLoginRequired builds an auth client when isLoginRequiredFn is unset, so the test dialed the profile's management URL — api.netbird.io:443. It took 1.05s locally and would hang on a runner with no egress, for a fact about the gate that needs no network at all. Stubbed like the login_outcome tests do. The test now runs in 0.00s. Reported by cubic-dev-ai on PR #7398.
This commit is contained in:
@@ -295,6 +295,11 @@ func TestLogin_RestatingTheStoredConfigPassesTheGate(t *testing.T) {
|
||||
s.updateSettingsDisabled = true
|
||||
s.rootCtx = internal.CtxInitState(context.Background())
|
||||
|
||||
// Stand in for the management round trip the handler makes once the gate
|
||||
// lets it through, so this test exercises the gate and not the network:
|
||||
// without it the profile's management URL is dialed for real.
|
||||
s.isLoginRequiredFn = func(context.Context) (bool, error) { return false, nil }
|
||||
|
||||
_, err := s.Login(userCtx(), &proto.LoginRequest{
|
||||
Username: &username,
|
||||
ManagementUrl: storedManagementURL,
|
||||
|
||||
Reference in New Issue
Block a user