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

Function TestDERPOnly

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

Source from the content-addressed store, hash-verified

46)
47
48func TestDERPOnly(t *testing.T) {
49 t.Parallel()
50
51 deploymentValues := coderdtest.DeploymentValues(t)
52 deploymentValues.Experiments = []string{
53 "*",
54 }
55
56 client, closer, api, _ := coderdenttest.NewWithAPI(t, &coderdenttest.Options{
57 Options: &coderdtest.Options{
58 DeploymentValues: deploymentValues,
59 AppHostname: "*.primary.test.coder.com",
60 IncludeProvisionerDaemon: true,
61 RealIPConfig: &httpmw.RealIPConfig{
62 TrustedOrigins: []*net.IPNet{{
63 IP: net.ParseIP("127.0.0.1"),
64 Mask: net.CIDRMask(8, 32),
65 }},
66 TrustedHeaders: []string{
67 "CF-Connecting-IP",
68 },
69 },
70 },
71 LicenseOptions: &coderdenttest.LicenseOptions{
72 Features: license.Features{
73 codersdk.FeatureWorkspaceProxy: 1,
74 codersdk.FeatureMultipleOrganizations: 1,
75 },
76 },
77 })
78 t.Cleanup(func() {
79 _ = closer.Close()
80 })
81
82 // Create an external proxy.
83 _ = coderdenttest.NewWorkspaceProxyReplica(t, api, client, &coderdenttest.ProxyOptions{
84 Name: "best-proxy",
85 DerpOnly: true,
86 })
87
88 // Should not show up in the regions list.
89 ctx := testutil.Context(t, testutil.WaitLong)
90 regions, err := client.Regions(ctx)
91 require.NoError(t, err)
92 require.Len(t, regions, 1)
93 require.Equal(t, api.Options.AccessURL.String(), regions[0].PathAppURL)
94}
95
96func TestDERP(t *testing.T) {
97 t.Parallel()

Callers

nothing calls this directly

Calls 10

DeploymentValuesFunction · 0.92
NewWithAPIFunction · 0.92
NewWorkspaceProxyReplicaFunction · 0.92
ContextFunction · 0.92
RegionsMethod · 0.80
CleanupMethod · 0.65
CloseMethod · 0.65
LenMethod · 0.45
EqualMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected