Skip to content

Commit d4a8b81

Browse files
committed
fix unit tests
1 parent 55b4527 commit d4a8b81

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

coderd/database/dbauthz/querier_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,10 @@ func (s *MethodTestSuite) TestLicense() {
336336
check.Args().Asserts().Returns("")
337337
}))
338338
s.Run("GetDefaultProxyConfig", s.Subtest(func(db database.Store, check *expects) {
339-
check.Args().Asserts().Returns(database.GetDefaultProxyConfigRow{})
339+
check.Args().Asserts().Returns(database.GetDefaultProxyConfigRow{
340+
DisplayName: "Default",
341+
IconUrl: "/emojis/1f3e1.png",
342+
})
340343
}))
341344
s.Run("GetLogoURL", s.Subtest(func(db database.Store, check *expects) {
342345
err := db.UpsertLogoURL(context.Background(), "value")

enterprise/cli/workspaceproxy_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,15 @@ func Test_ProxyCRUD(t *testing.T) {
8282
// Also check via the api
8383
proxies, err := client.WorkspaceProxies(ctx)
8484
require.NoError(t, err, "failed to get workspace proxies")
85-
require.Len(t, proxies, 1, "expected 1 proxy")
86-
require.Equal(t, expectedName, proxies[0].Name, "expected proxy name to match")
85+
// Include primary
86+
require.Len(t, proxies, 2, "expected 1 proxy")
87+
found := false
88+
for _, proxy := range proxies {
89+
if proxy.Name == expectedName {
90+
found = true
91+
}
92+
}
93+
require.True(t, found, "expected proxy to be found")
8794
})
8895

8996
t.Run("Delete", func(t *testing.T) {
@@ -130,6 +137,6 @@ func Test_ProxyCRUD(t *testing.T) {
130137

131138
proxies, err := client.WorkspaceProxies(ctx)
132139
require.NoError(t, err, "failed to get workspace proxies")
133-
require.Len(t, proxies, 0, "expected no proxies")
140+
require.Len(t, proxies, 1, "expected only primary proxy")
134141
})
135142
}

enterprise/coderd/workspaceproxy_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ func TestWorkspaceProxyCRUD(t *testing.T) {
325325

326326
proxies, err := client.WorkspaceProxies(ctx)
327327
require.NoError(t, err)
328-
require.Len(t, proxies, 0)
328+
// Default proxy is always there
329+
require.Len(t, proxies, 1)
329330
})
330331
}
331332

0 commit comments

Comments
 (0)