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

Function Test_vscodeProxyURI

coderd/agentapi/manifest_internal_test.go:13–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func Test_vscodeProxyURI(t *testing.T) {
14 t.Parallel()
15
16 coderAccessURL, err := url.Parse("https://coder.com")
17 require.NoError(t, err)
18
19 accessURLWithPort, err := url.Parse("https://coder.com:8080")
20 require.NoError(t, err)
21
22 basicApp := appurl.ApplicationURL{
23 Prefix: "prefix",
24 AppSlugOrPort: "slug",
25 AgentName: "agent",
26 WorkspaceName: "workspace",
27 Username: "user",
28 }
29
30 cases := []struct {
31 Name string
32 App appurl.ApplicationURL
33 AccessURL *url.URL
34 AppHostname string
35 Expected string
36 }{
37 {
38 Name: "NoHostname",
39 AccessURL: coderAccessURL,
40 AppHostname: "",
41 App: basicApp,
42 Expected: "",
43 },
44 {
45 Name: "NoHostnameAccessURLPort",
46 AccessURL: accessURLWithPort,
47 AppHostname: "",
48 App: basicApp,
49 Expected: "",
50 },
51 {
52 Name: "Hostname",
53 AccessURL: coderAccessURL,
54 AppHostname: "*.apps.coder.com",
55 App: basicApp,
56 Expected: fmt.Sprintf("https://%s.apps.coder.com", basicApp.String()),
57 },
58 {
59 Name: "HostnameWithAccessURLPort",
60 AccessURL: accessURLWithPort,
61 AppHostname: "*.apps.coder.com",
62 App: basicApp,
63 Expected: fmt.Sprintf("https://%s.apps.coder.com:%s", basicApp.String(), accessURLWithPort.Port()),
64 },
65 {
66 Name: "HostnameWithPort",
67 AccessURL: coderAccessURL,
68 AppHostname: "*.apps.coder.com:4444",
69 App: basicApp,
70 Expected: fmt.Sprintf("https://%s.apps.coder.com:%s", basicApp.String(), "4444"),

Callers

nothing calls this directly

Calls 5

StringMethod · 0.95
vscodeProxyURIFunction · 0.85
ParseMethod · 0.65
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected