MCPcopy Create free account
hub / github.com/tailscale/tailscale / TestNoControlConnWhenDown

Function TestNoControlConnWhenDown

tstest/integration/integration_test.go:1131–1175  ·  view source on GitHub ↗

Issue 2434: when "down" (WantRunning false), tailscaled shouldn't be connected to control.

(t *testing.T)

Source from the content-addressed store, hash-verified

1129// Issue 2434: when "down" (WantRunning false), tailscaled shouldn't
1130// be connected to control.
1131func TestNoControlConnWhenDown(t *testing.T) {
1132 tstest.Parallel(t)
1133 env := NewTestEnv(t)
1134 n1 := NewTestNode(t, env)
1135
1136 d1 := n1.StartDaemon()
1137 n1.AwaitResponding()
1138
1139 // Come up the first time.
1140 n1.MustUp()
1141 ip1 := n1.AwaitIP4()
1142 n1.AwaitRunning()
1143
1144 // Then bring it down and stop the daemon.
1145 n1.MustDown()
1146 d1.MustCleanShutdown(t)
1147
1148 env.LogCatcher.Reset()
1149 d2 := n1.StartDaemon()
1150 n1.AwaitResponding()
1151
1152 n1.AwaitBackendState("Stopped")
1153
1154 // The real test: verify our daemon doesn't have an HTTP request open.
1155 // Stopping the client may take some time to disconnect from testcontrol.
1156 if err := tstest.WaitFor(time.Second, func() error {
1157 if n := env.Control.InServeMap(); n != 0 {
1158 return fmt.Errorf("in serve map = %d; want 0", n)
1159 }
1160 return nil
1161 }); err != nil {
1162 t.Fatalf("unexpected connections while stopped: %v", err)
1163 }
1164
1165 ip2 := n1.AwaitIP4()
1166 if ip1 != ip2 {
1167 t.Errorf("IPs different: %q vs %q", ip1, ip2)
1168 }
1169
1170 if n := env.Control.InServeMap(); n != 0 {
1171 t.Fatalf("unexpected connection triggered by tailscale ip: in serve map = %d; want 0", n)
1172 }
1173
1174 d2.MustCleanShutdown(t)
1175}
1176
1177// Issue 2137: make sure Windows tailscaled works with the CLI alone,
1178// without the GUI to kick off a Start.

Callers

nothing calls this directly

Calls 15

StartDaemonMethod · 0.95
AwaitRespondingMethod · 0.95
MustUpMethod · 0.95
AwaitIP4Method · 0.95
AwaitRunningMethod · 0.95
MustDownMethod · 0.95
AwaitBackendStateMethod · 0.95
ParallelFunction · 0.92
WaitForFunction · 0.92
NewTestEnvFunction · 0.85
NewTestNodeFunction · 0.85
MustCleanShutdownMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…