MCPcopy Index your code
hub / github.com/coder/coder / GracefulDisconnectTest

Function GracefulDisconnectTest

tailnet/test/cases.go:11–26  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, coordinator tailnet.CoordinatorV2)

Source from the content-addressed store, hash-verified

9)
10
11func GracefulDisconnectTest(ctx context.Context, t *testing.T, coordinator tailnet.CoordinatorV2) {
12 p1 := NewPeer(ctx, t, coordinator, "p1")
13 defer p1.Close(ctx)
14 p2 := NewPeer(ctx, t, coordinator, "p2")
15 defer p2.Close(ctx)
16 p1.AddTunnel(p2.ID)
17 p1.UpdateDERP(1)
18 p2.UpdateDERP(2)
19
20 p1.AssertEventuallyHasDERP(p2.ID, 2)
21 p2.AssertEventuallyHasDERP(p1.ID, 1)
22
23 p2.Disconnect()
24 p1.AssertEventuallyDisconnected(p2.ID)
25 p2.AssertEventuallyResponsesClosed("")
26}
27
28func LostTest(ctx context.Context, t *testing.T, coordinator tailnet.CoordinatorV2) {
29 p1 := NewPeer(ctx, t, coordinator, "p1")

Callers 1

Calls 8

CloseMethod · 0.95
AddTunnelMethod · 0.95
UpdateDERPMethod · 0.95
DisconnectMethod · 0.95
NewPeerFunction · 0.85

Tested by 1