Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix unit test
  • Loading branch information
Emyrk committed Mar 31, 2023
commit d4260b5300d5dd52d3f170a8017e4e0c7caff1c6
10 changes: 7 additions & 3 deletions coderd/database/dbauthz/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,13 @@ func (s *MethodTestSuite) TestWorkspaceProxy() {
}).Asserts(p, rbac.ActionDelete)
}))
s.Run("GetWorkspaceProxies", s.Subtest(func(db database.Store, check *expects) {
p1 := dbgen.WorkspaceProxy(s.T(), db, database.WorkspaceProxy{})
p2 := dbgen.WorkspaceProxy(s.T(), db, database.WorkspaceProxy{})
check.Args().Asserts(p1, rbac.ActionRead, p2, rbac.ActionRead).Returns(slice.New(p1, p2))
p1 := dbgen.WorkspaceProxy(s.T(), db, database.WorkspaceProxy{
OrganizationID: uuid.New(),
})
p2 := dbgen.WorkspaceProxy(s.T(), db, database.WorkspaceProxy{
OrganizationID: p1.OrganizationID,
})
check.Args(p1.OrganizationID).Asserts(p1, rbac.ActionRead, p2, rbac.ActionRead).Returns(slice.New(p1, p2))
}))
}

Expand Down
1 change: 1 addition & 0 deletions coderd/database/dbgen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ func WorkspaceProxy(t testing.TB, db database.Store, orig database.WorkspaceProx
ID: takeFirst(orig.ID, uuid.New()),
OrganizationID: takeFirst(orig.OrganizationID, uuid.New()),
Name: takeFirst(orig.Name, namesgenerator.GetRandomName(1)),
DisplayName: takeFirst(orig.DisplayName, namesgenerator.GetRandomName(1)),
Icon: takeFirst(orig.Icon, namesgenerator.GetRandomName(1)),
Url: takeFirst(orig.Url, fmt.Sprintf("https://%s.com", namesgenerator.GetRandomName(1))),
WildcardUrl: takeFirst(orig.WildcardUrl, fmt.Sprintf("https://*.%s.com", namesgenerator.GetRandomName(1))),
Expand Down
2 changes: 1 addition & 1 deletion enterprise/coderd/workspaceproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (api *API) postWorkspaceProxyByOrganization(rw http.ResponseWriter, r *http
httpapi.Write(ctx, rw, http.StatusCreated, convertProxy(proxy))
}

// nolint:flag-parameter
// nolint:revive
func validateProxyURL(u string, wildcard bool) error {
p, err := url.Parse(u)
if err != nil {
Expand Down