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

Function TestConfigMaps_setBlockEndpoints_same

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

Source from the content-addressed store, hash-verified

857}
858
859func TestConfigMaps_setBlockEndpoints_same(t *testing.T) {
860 t.Parallel()
861 ctx := testutil.Context(t, testutil.WaitShort)
862 logger := testutil.Logger(t)
863 fEng := newFakeEngineConfigurable()
864 nodePrivateKey := key.NewNode()
865 nodeID := tailcfg.NodeID(5)
866 discoKey := key.NewDisco()
867 uut := newConfigMaps(logger, fEng, nodeID, nodePrivateKey, discoKey.Public(), CoderDNSSuffixFQDN)
868 defer uut.close()
869
870 p1ID := uuid.MustParse("10000000-0000-0000-0000-000000000000")
871 p1Node := newTestNode(1)
872 p1n, err := NodeToProto(p1Node)
873 require.NoError(t, err)
874 p1tcn, err := uut.protoNodeToTailcfg(p1n)
875 p1tcn.KeepAlive = true
876 require.NoError(t, err)
877
878 // Given: peer already exists && blockEndpoints set to true
879 uut.L.Lock()
880 uut.peers[p1ID] = &peerLifecycle{
881 peerID: p1ID,
882 node: p1tcn,
883 lastHandshake: time.Date(2024, 1, 7, 12, 0, 10, 0, time.UTC),
884 }
885 uut.blockEndpoints = true
886 uut.L.Unlock()
887
888 // Then: we don't configure
889 requireNeverConfigures(ctx, t, &uut.phased)
890
891 // When we set blockEndpoints to true
892 uut.setBlockEndpoints(true)
893
894 done := make(chan struct{})
895 go func() {
896 defer close(done)
897 uut.close()
898 }()
899 _ = testutil.TryReceive(ctx, t, done)
900}
901
902func TestConfigMaps_setDERPMap_different(t *testing.T) {
903 t.Parallel()

Callers

nothing calls this directly

Calls 13

ContextFunction · 0.92
LoggerFunction · 0.92
TryReceiveFunction · 0.92
newConfigMapsFunction · 0.85
newTestNodeFunction · 0.85
NodeToProtoFunction · 0.85
requireNeverConfiguresFunction · 0.85
protoNodeToTailcfgMethod · 0.80
closeMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected