(t *testing.T)
| 857 | } |
| 858 | |
| 859 | func 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 | |
| 902 | func TestConfigMaps_setDERPMap_different(t *testing.T) { |
| 903 | t.Parallel() |
nothing calls this directly
no test coverage detected