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

Function TestRewriteDERPMap

codersdk/agentsdk/agentsdk_test.go:130–156  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestRewriteDERPMap(t *testing.T) {
131 t.Parallel()
132 // This test ensures that RewriteDERPMap mutates built-in DERPs with the
133 // client access URL.
134 dm := &tailcfg.DERPMap{
135 Regions: map[int]*tailcfg.DERPRegion{
136 1: {
137 EmbeddedRelay: true,
138 RegionID: 1,
139 Nodes: []*tailcfg.DERPNode{{
140 HostName: "bananas.org",
141 DERPPort: 1,
142 }},
143 },
144 },
145 }
146 parsed, err := url.Parse("https://coconuts.org:44558")
147 require.NoError(t, err)
148 client := agentsdk.New(parsed, agentsdk.WithFixedToken("unused"))
149 client.RewriteDERPMap(dm)
150 region := dm.Regions[1]
151 require.True(t, region.EmbeddedRelay)
152 require.Len(t, region.Nodes, 1)
153 node := region.Nodes[0]
154 require.Equal(t, "coconuts.org", node.HostName)
155 require.Equal(t, 44558, node.DERPPort)
156}
157
158func TestExternalAuthRequestQuery(t *testing.T) {
159 t.Parallel()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
WithFixedTokenFunction · 0.92
ParseMethod · 0.65
RewriteDERPMapMethod · 0.65
LenMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected