Skip to content

Commit 41d1b66

Browse files
committed
Accounting for dbmem
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
1 parent 00616f5 commit 41d1b66

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

coderd/members_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package coderd_test
22

33
import (
4-
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
54
"testing"
65

6+
"github.com/coder/coder/v2/coderd/database/dbtestutil"
7+
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
8+
79
"github.com/google/uuid"
810
"github.com/stretchr/testify/require"
911

@@ -54,6 +56,12 @@ func TestListMembers(t *testing.T) {
5456
t.Parallel()
5557

5658
t.Run("OK", func(t *testing.T) {
59+
60+
// TODO: we should not be returning the prebuilds user in OrganizationMembers, and this is not returned in dbmem.
61+
if !dbtestutil.WillUsePostgres() {
62+
t.Skip("This test requires postgres")
63+
}
64+
5765
t.Parallel()
5866
owner := coderdtest.New(t, nil)
5967
first := coderdtest.CreateFirstUser(t, owner)

enterprise/coderd/groups_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package coderd_test
22

33
import (
4-
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
54
"net/http"
65
"sort"
76
"testing"
87
"time"
98

9+
"github.com/coder/coder/v2/coderd/database/dbtestutil"
10+
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
11+
1012
"github.com/google/uuid"
1113
"github.com/stretchr/testify/require"
1214

@@ -823,6 +825,11 @@ func TestGroup(t *testing.T) {
823825
// TODO (sasswart): this test seems to have drifted from its original intention. evaluate and remove/fix
824826
t.Parallel()
825827

828+
// TODO: we should not be returning the prebuilds user in Group, and this is not returned in dbmem.
829+
if !dbtestutil.WillUsePostgres() {
830+
t.Skip("This test requires postgres")
831+
}
832+
826833
client, user := coderdenttest.New(t, &coderdenttest.Options{LicenseOptions: &coderdenttest.LicenseOptions{
827834
Features: license.Features{
828835
codersdk.FeatureTemplateRBAC: 1,

enterprise/coderd/prebuilds/claim_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ func (m *storeSpy) ClaimPrebuild(ctx context.Context, arg database.ClaimPrebuild
7070
func TestClaimPrebuild(t *testing.T) {
7171
t.Parallel()
7272

73+
if !dbtestutil.WillUsePostgres() {
74+
t.Skip("This test requires postgres")
75+
}
76+
7377
const (
7478
desiredInstances = 1
7579
presetCount = 2

enterprise/coderd/roles_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ package coderd_test
33
import (
44
"bytes"
55
"context"
6-
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
76
"net/http"
87
"slices"
98
"testing"
109

10+
"github.com/coder/coder/v2/coderd/database/dbtestutil"
11+
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
12+
1113
"github.com/google/uuid"
1214
"github.com/stretchr/testify/require"
1315

@@ -334,6 +336,12 @@ func TestCustomOrganizationRole(t *testing.T) {
334336
// Verify deleting a custom role cascades to all members
335337
t.Run("DeleteRoleCascadeMembers", func(t *testing.T) {
336338
t.Parallel()
339+
340+
// TODO: we should not be returning the prebuilds user in OrganizationMembers, and this is not returned in dbmem.
341+
if !dbtestutil.WillUsePostgres() {
342+
t.Skip("This test requires postgres")
343+
}
344+
337345
owner, first := coderdenttest.New(t, &coderdenttest.Options{
338346
LicenseOptions: &coderdenttest.LicenseOptions{
339347
Features: license.Features{

enterprise/coderd/templates_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/coder/coder/v2/coderd/audit"
1919
"github.com/coder/coder/v2/coderd/coderdtest"
2020
"github.com/coder/coder/v2/coderd/database"
21+
"github.com/coder/coder/v2/coderd/database/dbtestutil"
2122
"github.com/coder/coder/v2/coderd/notifications"
2223
"github.com/coder/coder/v2/coderd/notifications/notificationstest"
2324
"github.com/coder/coder/v2/coderd/rbac"
@@ -922,6 +923,12 @@ func TestTemplateACL(t *testing.T) {
922923

923924
t.Run("everyoneGroup", func(t *testing.T) {
924925
t.Parallel()
926+
927+
// TODO: we should not be returning the prebuilds user in TemplateACL, and this is not returned in dbmem.
928+
if !dbtestutil.WillUsePostgres() {
929+
t.Skip("This test requires postgres")
930+
}
931+
925932
client, user := coderdenttest.New(t, &coderdenttest.Options{LicenseOptions: &coderdenttest.LicenseOptions{
926933
Features: license.Features{
927934
codersdk.FeatureTemplateRBAC: 1,

0 commit comments

Comments
 (0)