MCPcopy Index your code
hub / github.com/tailscale/tailscale / TestNetmapForMapResponseForDebug

Function TestNetmapForMapResponseForDebug

control/controlclient/map_test.go:1892–1914  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1890}
1891
1892func TestNetmapForMapResponseForDebug(t *testing.T) {
1893 mr := &tailcfg.MapResponse{
1894 Node: &tailcfg.Node{
1895 ID: 1,
1896 Name: "foo.bar.ts.net.",
1897 },
1898 Peers: []*tailcfg.Node{
1899 {ID: 2, Name: "peer1.bar.ts.net.", HomeDERP: 1},
1900 {ID: 3, Name: "peer2.bar.ts.net.", HomeDERP: 1},
1901 },
1902 }
1903 ms := newTestMapSession(t, nil)
1904 nm1 := ms.netmapForResponse(mr)
1905
1906 prefs := &ipn.Prefs{Persist: &persist.Persist{PrivateNodeKey: ms.privateNodeKey}}
1907 nm2, err := NetmapFromMapResponseForDebug(t.Context(), prefs.View().Persist(), mr)
1908 if err != nil {
1909 t.Fatal(err)
1910 }
1911 if !reflect.DeepEqual(nm1, nm2) {
1912 t.Errorf("mismatch\nnm1: %s\nnm2: %s\n", logger.AsJSON(nm1), logger.AsJSON(nm2))
1913 }
1914}
1915
1916func TestLearnZstdOfKeepAlive(t *testing.T) {
1917 keepAliveMsgZstd := (func() []byte {

Callers

nothing calls this directly

Calls 9

ViewMethod · 0.95
AsJSONFunction · 0.92
newTestMapSessionFunction · 0.85
netmapForResponseMethod · 0.80
ContextMethod · 0.65
FatalMethod · 0.65
ErrorfMethod · 0.65
PersistMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…