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

Function TestDERPEndToEnd

enterprise/wsproxy/wsproxy_test.go:322–457  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

320}
321
322func TestDERPEndToEnd(t *testing.T) {
323 t.Parallel()
324
325 deploymentValues := coderdtest.DeploymentValues(t)
326 deploymentValues.Experiments = []string{
327 "*",
328 }
329 deploymentValues.DERP.Config.BlockDirect = true
330
331 client, closer, api, user := coderdenttest.NewWithAPI(t, &coderdenttest.Options{
332 Options: &coderdtest.Options{
333 DeploymentValues: deploymentValues,
334 AppHostname: "*.primary.test.coder.com",
335 IncludeProvisionerDaemon: true,
336 RealIPConfig: &httpmw.RealIPConfig{
337 TrustedOrigins: []*net.IPNet{{
338 IP: net.ParseIP("127.0.0.1"),
339 Mask: net.CIDRMask(8, 32),
340 }},
341 TrustedHeaders: []string{
342 "CF-Connecting-IP",
343 },
344 },
345 },
346 LicenseOptions: &coderdenttest.LicenseOptions{
347 Features: license.Features{
348 codersdk.FeatureWorkspaceProxy: 1,
349 codersdk.FeatureMultipleOrganizations: 1,
350 },
351 },
352 })
353 t.Cleanup(func() {
354 _ = closer.Close()
355 })
356
357 coderdenttest.NewWorkspaceProxyReplica(t, api, client, &coderdenttest.ProxyOptions{
358 Name: "best-proxy",
359 })
360
361 // Wait for the proxy to become healthy.
362 ctx := testutil.Context(t, testutil.WaitLong)
363 require.Eventually(t, func() bool {
364 err := api.ProxyHealth.ForceUpdate(ctx)
365 if !assert.NoError(t, err) {
366 return false
367 }
368
369 regions, err := client.Regions(ctx)
370 if !assert.NoError(t, err) {
371 return false
372 }
373 if !assert.Len(t, regions, 2) {
374 return false
375 }
376 for _, r := range regions {
377 if !r.Healthy {
378 return false
379 }

Callers

nothing calls this directly

Calls 15

DeploymentValuesFunction · 0.92
NewWithAPIFunction · 0.92
NewWorkspaceProxyReplicaFunction · 0.92
ContextFunction · 0.92
CreateTemplateVersionFunction · 0.92
ProvisionGraphWithAgentFunction · 0.92
CreateTemplateFunction · 0.92
CreateWorkspaceFunction · 0.92
NewFunction · 0.92
AwaitWorkspaceAgentsFunction · 0.92

Tested by

no test coverage detected