TestDERPMesh spawns 6 workspace proxy replicas and tries to connect to a single DERP peer via every single one.
(t *testing.T)
| 459 | // TestDERPMesh spawns 6 workspace proxy replicas and tries to connect to a |
| 460 | // single DERP peer via every single one. |
| 461 | func TestDERPMesh(t *testing.T) { |
| 462 | t.Parallel() |
| 463 | |
| 464 | deploymentValues := coderdtest.DeploymentValues(t) |
| 465 | deploymentValues.Experiments = []string{ |
| 466 | "*", |
| 467 | } |
| 468 | |
| 469 | ctx := testutil.Context(t, testutil.WaitLong) |
| 470 | client, closer, api, _ := coderdenttest.NewWithAPI(t, &coderdenttest.Options{ |
| 471 | Options: &coderdtest.Options{ |
| 472 | DeploymentValues: deploymentValues, |
| 473 | AppHostname: "*.primary.test.coder.com", |
| 474 | IncludeProvisionerDaemon: true, |
| 475 | RealIPConfig: &httpmw.RealIPConfig{ |
| 476 | TrustedOrigins: []*net.IPNet{{ |
| 477 | IP: net.ParseIP("127.0.0.1"), |
| 478 | Mask: net.CIDRMask(8, 32), |
| 479 | }}, |
| 480 | TrustedHeaders: []string{ |
| 481 | "CF-Connecting-IP", |
| 482 | }, |
| 483 | }, |
| 484 | }, |
| 485 | LicenseOptions: &coderdenttest.LicenseOptions{ |
| 486 | Features: license.Features{ |
| 487 | codersdk.FeatureWorkspaceProxy: 1, |
| 488 | codersdk.FeatureMultipleOrganizations: 1, |
| 489 | }, |
| 490 | }, |
| 491 | }) |
| 492 | t.Cleanup(func() { |
| 493 | _ = closer.Close() |
| 494 | }) |
| 495 | |
| 496 | proxyURL, err := url.Parse("https://proxy.test.coder.com") |
| 497 | require.NoError(t, err) |
| 498 | |
| 499 | // Create 3 proxy replicas. |
| 500 | proxies := createProxyReplicas(ctx, t, &createProxyReplicasOptions{ |
| 501 | API: api, |
| 502 | Client: client, |
| 503 | Name: "best-proxy", |
| 504 | ProxyURL: proxyURL, |
| 505 | ProxyToken: "", // will be generated automatically |
| 506 | Count: 3, |
| 507 | }) |
| 508 | derpURLs := make([]string, len(proxies)) |
| 509 | for i, proxy := range proxies { |
| 510 | derpURL := *proxy.ServerURL |
| 511 | derpURL.Path = "/derp" |
| 512 | derpURLs[i] = derpURL.String() |
| 513 | } |
| 514 | |
| 515 | // Generate cases. We have a case for: |
| 516 | // - Each proxy to itself. |
| 517 | // - Each proxy to each other proxy (one way, no duplicates). |
| 518 | cases := [][2]string{} |
nothing calls this directly
no test coverage detected