Skip to content

Commit e088a0e

Browse files
committed
Use only 1 organization for unit test
1 parent fe7fe14 commit e088a0e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

coderd/users.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ func (api *api) users(rw http.ResponseWriter, r *http.Request) {
149149
userIDs = append(userIDs, user.ID)
150150
}
151151
organizationIDsByMemberIDsRows, err := api.Database.GetOrganizationIDsByMemberIDs(r.Context(), userIDs)
152+
if xerrors.Is(err, sql.ErrNoRows) {
153+
err = nil
154+
}
152155
if err != nil {
153156
httpapi.Write(rw, http.StatusInternalServerError, httpapi.Response{
154157
Message: err.Error(),

coderd/users_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,14 +454,12 @@ func TestPaginatedUsers(t *testing.T) {
454454
coderdtest.CreateFirstUser(t, client)
455455
me, err := client.User(context.Background(), codersdk.Me)
456456
require.NoError(t, err)
457+
orgID := me.OrganizationIDs[0]
457458

458459
allUsers := make([]codersdk.User, 0)
459460
allUsers = append(allUsers, me)
460461
specialUsers := make([]codersdk.User, 0)
461462

462-
org, err := client.CreateOrganization(ctx, me.ID, codersdk.CreateOrganizationRequest{
463-
Name: "default",
464-
})
465463
require.NoError(t, err)
466464

467465
// When 100 users exist
@@ -484,7 +482,7 @@ func TestPaginatedUsers(t *testing.T) {
484482
Email: email,
485483
Username: username,
486484
Password: "password",
487-
OrganizationID: org.ID,
485+
OrganizationID: orgID,
488486
})
489487
require.NoError(t, err)
490488
allUsers = append(allUsers, newUser)

0 commit comments

Comments
 (0)