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

Function TestNetworkMapConcise

types/netmap/netmap_test.go:55–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestNetworkMapConcise(t *testing.T) {
56 for _, tt := range []struct {
57 name string
58 nm *NetworkMap
59 want string
60 }{
61 {
62 name: "basic",
63 nm: &NetworkMap{
64 NodeKey: testNodeKey(1),
65 Peers: nodeViews([]*tailcfg.Node{
66 {
67 Key: testNodeKey(2),
68 HomeDERP: 2,
69 Endpoints: eps("192.168.0.100:12", "192.168.0.100:12354"),
70 },
71 {
72 Key: testNodeKey(3),
73 HomeDERP: 4,
74 Endpoints: eps("10.2.0.100:12", "10.1.0.100:12345"),
75 },
76 }),
77 },
78 want: "netmap: self: [AQEBA] auth=machine-unknown u=? []\n [AgICA] D2 : 192.168.0.100:12 192.168.0.100:12354\n [AwMDA] D4 : 10.2.0.100:12 10.1.0.100:12345\n",
79 },
80 } {
81 t.Run(tt.name, func(t *testing.T) {
82 var got string
83 n := int(testing.AllocsPerRun(1000, func() {
84 got = tt.nm.Concise()
85 }))
86 t.Logf("Allocs = %d", n)
87 if got != tt.want {
88 t.Errorf("Wrong output\n Got: %q\nWant: %q\n## Got (unescaped):\n%s\n## Want (unescaped):\n%s\n", got, tt.want, got, tt.want)
89 }
90 })
91 }
92}
93
94func TestConciseDiffFrom(t *testing.T) {
95 for _, tt := range []struct {

Callers

nothing calls this directly

Calls 7

testNodeKeyFunction · 0.85
ConciseMethod · 0.80
nodeViewsFunction · 0.70
epsFunction · 0.70
RunMethod · 0.65
LogfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…