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

Function TestConfigMaps_setAddresses_same

tailnet/configmaps_internal_test.go:87–116  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func TestConfigMaps_setAddresses_same(t *testing.T) {
88 t.Parallel()
89 ctx := testutil.Context(t, testutil.WaitShort)
90 logger := testutil.Logger(t)
91 fEng := newFakeEngineConfigurable()
92 nodePrivateKey := key.NewNode()
93 nodeID := tailcfg.NodeID(5)
94 discoKey := key.NewDisco()
95 addrs := []netip.Prefix{netip.MustParsePrefix("192.168.0.200/32")}
96 uut := newConfigMaps(logger, fEng, nodeID, nodePrivateKey, discoKey.Public(), CoderDNSSuffixFQDN)
97 defer uut.close()
98
99 // Given: addresses already set
100 uut.L.Lock()
101 uut.addresses = addrs
102 uut.L.Unlock()
103
104 // Then: it doesn't configure
105 requireNeverConfigures(ctx, t, &uut.phased)
106
107 // When: we set addresses
108 uut.setAddresses(addrs)
109
110 done := make(chan struct{})
111 go func() {
112 defer close(done)
113 uut.close()
114 }()
115 _ = testutil.TryReceive(ctx, t, done)
116}
117
118func TestConfigMaps_updatePeers_new(t *testing.T) {
119 t.Parallel()

Callers

nothing calls this directly

Calls 10

ContextFunction · 0.92
LoggerFunction · 0.92
TryReceiveFunction · 0.92
newConfigMapsFunction · 0.85
requireNeverConfiguresFunction · 0.85
closeMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
setAddressesMethod · 0.45

Tested by

no test coverage detected