Skip to content

Commit 66cd785

Browse files
committed
linting
1 parent 1250dbf commit 66cd785

File tree

8 files changed

+18
-19
lines changed

8 files changed

+18
-19
lines changed

enterprise/cli/organization_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ func TestEditOrganizationRoles(t *testing.T) {
114114
}
115115

116116
func TestShowOrganizations(t *testing.T) {
117+
t.Parallel()
118+
117119
t.Run("OnlyID", func(t *testing.T) {
118120
t.Parallel()
119121

enterprise/coderd/organizations_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func TestOrganizationsByUser(t *testing.T) {
7171

7272
ctx := testutil.Context(t, testutil.WaitLong)
7373

74+
//nolint:gocritic // owner is required to make orgs
7475
orgs, err := client.OrganizationsByUser(ctx, codersdk.Me)
7576
require.NoError(t, err)
7677
require.NotNil(t, orgs)

enterprise/coderd/roles_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,7 @@ func TestListRoles(t *testing.T) {
354354
member, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
355355
orgAdmin, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID, rbac.ScopedRoleOrgAdmin(owner.OrganizationID))
356356

357-
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
358-
t.Cleanup(cancel)
359-
360-
otherOrg, err := client.CreateOrganization(ctx, codersdk.CreateOrganizationRequest{
361-
Name: "other",
362-
})
363-
require.NoError(t, err, "create org")
357+
otherOrg := coderdenttest.CreateOrganization(t, client, coderdenttest.CreateOrganizationOptions{})
364358

365359
const notFound = "Resource not found"
366360
testCases := []struct {

enterprise/coderd/templates_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ func TestTemplates(t *testing.T) {
779779
t.Parallel()
780780
dv := coderdtest.DeploymentValues(t)
781781
dv.Experiments = []string{string(codersdk.ExperimentMultiOrganization)}
782-
client, owner := coderdenttest.New(t, &coderdenttest.Options{
782+
ownerClient, owner := coderdenttest.New(t, &coderdenttest.Options{
783783
Options: &coderdtest.Options{
784784
DeploymentValues: dv,
785785
},
@@ -790,8 +790,9 @@ func TestTemplates(t *testing.T) {
790790
},
791791
})
792792

793-
org2 := coderdenttest.CreateOrganization(t, client, coderdenttest.CreateOrganizationOptions{})
794-
user, _ := coderdtest.CreateAnotherUser(t, client, org2.ID)
793+
client, _ := coderdtest.CreateAnotherUser(t, ownerClient, owner.OrganizationID, rbac.RoleTemplateAdmin())
794+
org2 := coderdenttest.CreateOrganization(t, ownerClient, coderdenttest.CreateOrganizationOptions{})
795+
user, _ := coderdtest.CreateAnotherUser(t, ownerClient, org2.ID)
795796

796797
// 2 templates in first organization
797798
version := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, nil)

enterprise/coderd/users_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,6 @@ func TestGrantSiteRoles(t *testing.T) {
311311
require.Equal(t, statusCode, e.StatusCode(), "correct status code")
312312
}
313313

314-
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
315-
t.Cleanup(cancel)
316-
var err error
317-
318314
dv := coderdtest.DeploymentValues(t)
319315
dv.Experiments = []string{string(codersdk.ExperimentMultiOrganization)}
320316
admin, first := coderdenttest.New(t, &coderdenttest.Options{
@@ -331,10 +327,8 @@ func TestGrantSiteRoles(t *testing.T) {
331327

332328
member, _ := coderdtest.CreateAnotherUser(t, admin, first.OrganizationID)
333329
orgAdmin, _ := coderdtest.CreateAnotherUser(t, admin, first.OrganizationID, rbac.ScopedRoleOrgAdmin(first.OrganizationID))
334-
randOrg, err := admin.CreateOrganization(ctx, codersdk.CreateOrganizationRequest{
335-
Name: "random",
336-
})
337-
require.NoError(t, err)
330+
randOrg := coderdenttest.CreateOrganization(t, admin, coderdenttest.CreateOrganizationOptions{})
331+
338332
_, randOrgUser := coderdtest.CreateAnotherUser(t, admin, randOrg.ID, rbac.ScopedRoleOrgAdmin(randOrg.ID))
339333
userAdmin, _ := coderdtest.CreateAnotherUser(t, admin, first.OrganizationID, rbac.RoleUserAdmin())
340334

enterprise/coderd/workspaces_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,7 @@ func TestAdminViewAllWorkspaces(t *testing.T) {
13631363
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
13641364
defer cancel()
13651365

1366+
//nolint:gocritic // intentionally using owner
13661367
_, err := client.Workspace(ctx, workspace.ID)
13671368
require.NoError(t, err)
13681369

enterprise/members_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
)
1717

1818
func TestEnterpriseMembers(t *testing.T) {
19+
t.Parallel()
20+
1921
t.Run("PostUser", func(t *testing.T) {
2022
t.Parallel()
2123

@@ -77,6 +79,7 @@ func TestEnterpriseMembers(t *testing.T) {
7779

7880
ctx := testutil.Context(t, testutil.WaitMedium)
7981
// Add user to org
82+
//nolint:gocritic // Using owner to ensure it's not a 404 error
8083
_, err := owner.PostOrganizationMember(ctx, org.ID, uuid.NewString())
8184
require.Error(t, err)
8285
var apiErr *codersdk.Error
@@ -87,6 +90,7 @@ func TestEnterpriseMembers(t *testing.T) {
8790
// Calling it from a user without the org access.
8891
t.Run("ListNotInOrg", func(t *testing.T) {
8992
t.Parallel()
93+
9094
dv := coderdtest.DeploymentValues(t)
9195
dv.Experiments = []string{string(codersdk.ExperimentMultiOrganization)}
9296
owner, first := coderdenttest.New(t, &coderdenttest.Options{

enterprise/wsproxy/wsproxy_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ func TestWorkspaceProxyWorkspaceApps_BlockDirect(t *testing.T) {
998998
deploymentValues.Dangerous.AllowPathAppSiteOwnerAccess = serpent.Bool(opts.DangerousAllowPathAppSiteOwnerAccess)
999999
deploymentValues.Experiments = []string{
10001000
"*",
1001+
string(codersdk.ExperimentMultiOrganization),
10011002
}
10021003

10031004
proxyStatsCollectorFlushCh := make(chan chan<- struct{}, 1)
@@ -1028,7 +1029,8 @@ func TestWorkspaceProxyWorkspaceApps_BlockDirect(t *testing.T) {
10281029
},
10291030
LicenseOptions: &coderdenttest.LicenseOptions{
10301031
Features: license.Features{
1031-
codersdk.FeatureWorkspaceProxy: 1,
1032+
codersdk.FeatureWorkspaceProxy: 1,
1033+
codersdk.FeatureMultipleOrganizations: 1,
10321034
},
10331035
},
10341036
})

0 commit comments

Comments
 (0)