mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove references to dbtestutil.WillUsePostgres (#20436)
Addresses https://github.com/coder/internal/issues/758. This PR only cleans up dead code, it makes no changes to test logic.
This commit is contained in:
@@ -79,10 +79,6 @@ func TestEntitlements(t *testing.T) {
|
||||
require.Equal(t, fmt.Sprintf("%p", api.Entitlements), fmt.Sprintf("%p", api.AGPL.Entitlements))
|
||||
})
|
||||
t.Run("FullLicense", func(t *testing.T) {
|
||||
// PGCoordinator requires a real postgres
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("test only with postgres")
|
||||
}
|
||||
t.Parallel()
|
||||
adminClient, _ := coderdenttest.New(t, &coderdenttest.Options{
|
||||
AuditLogging: true,
|
||||
@@ -882,10 +878,6 @@ func (s *restartableTestServer) startWithFirstUser(t *testing.T) (client *coders
|
||||
func TestConn_CoordinatorRollingRestart(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("test only with postgres")
|
||||
}
|
||||
|
||||
// Although DERP will have connection issues until the connection is
|
||||
// reestablished, any open connections should be maintained.
|
||||
//
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
"github.com/coder/coder/v2/coderd/coderdtest"
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtestutil"
|
||||
"github.com/coder/coder/v2/coderd/notifications"
|
||||
"github.com/coder/coder/v2/codersdk"
|
||||
"github.com/coder/coder/v2/enterprise/coderd/coderdenttest"
|
||||
@@ -36,10 +35,6 @@ func TestUpdateNotificationTemplateMethod(t *testing.T) {
|
||||
t.Run("Happy path", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("This test requires postgres; it relies on read from and writing to the notification_templates table")
|
||||
}
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitSuperLong)
|
||||
api, _ := coderdenttest.New(t, createOpts(t))
|
||||
|
||||
@@ -67,10 +62,6 @@ func TestUpdateNotificationTemplateMethod(t *testing.T) {
|
||||
t.Run("Insufficient permissions", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("This test requires postgres; it relies on read from and writing to the notification_templates table")
|
||||
}
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitSuperLong)
|
||||
|
||||
// Given: the first user which has an "owner" role, and another user which does not.
|
||||
@@ -91,10 +82,6 @@ func TestUpdateNotificationTemplateMethod(t *testing.T) {
|
||||
t.Run("Invalid notification method", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("This test requires postgres; it relies on read from and writing to the notification_templates table")
|
||||
}
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitSuperLong)
|
||||
|
||||
// Given: the first user which has an "owner" role
|
||||
@@ -120,10 +107,6 @@ func TestUpdateNotificationTemplateMethod(t *testing.T) {
|
||||
t.Run("Not modified", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("This test requires postgres; it relies on read from and writing to the notification_templates table")
|
||||
}
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitSuperLong)
|
||||
api, _ := coderdenttest.New(t, createOpts(t))
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/dbauthz"
|
||||
"github.com/coder/coder/v2/coderd/database/dbgen"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtestutil"
|
||||
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
|
||||
"github.com/coder/coder/v2/testutil"
|
||||
)
|
||||
@@ -91,14 +90,6 @@ func TestReconcileAll(t *testing.T) {
|
||||
unrelatedOrg := dbgen.Organization(t, db, database.Organization{})
|
||||
targetOrg := dbgen.Organization(t, db, database.Organization{})
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
// dbmem doesn't ensure membership to the default organization
|
||||
dbgen.OrganizationMember(t, db, database.OrganizationMember{
|
||||
OrganizationID: defaultOrg.ID,
|
||||
UserID: database.PrebuildsSystemUserID,
|
||||
})
|
||||
}
|
||||
|
||||
// Ensure membership to unrelated org.
|
||||
dbgen.OrganizationMember(t, db, database.OrganizationMember{OrganizationID: unrelatedOrg.ID, UserID: database.PrebuildsSystemUserID})
|
||||
|
||||
|
||||
@@ -30,10 +30,6 @@ import (
|
||||
func TestMetricsCollector(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("this test requires postgres")
|
||||
}
|
||||
|
||||
type metricCheck struct {
|
||||
name string
|
||||
value *float64
|
||||
@@ -298,10 +294,6 @@ func TestMetricsCollector(t *testing.T) {
|
||||
func TestMetricsCollector_DuplicateTemplateNames(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("this test requires postgres")
|
||||
}
|
||||
|
||||
type metricCheck struct {
|
||||
name string
|
||||
value *float64
|
||||
@@ -478,10 +470,6 @@ func findAllMetricSeries(metricsFamilies []*prometheus_client.MetricFamily, labe
|
||||
func TestMetricsCollector_ReconciliationPausedMetric(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("this test requires postgres")
|
||||
}
|
||||
|
||||
t.Run("reconciliation_not_paused", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -20,9 +20,7 @@ import (
|
||||
|
||||
func TestReplicas(t *testing.T) {
|
||||
t.Parallel()
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("only test with real postgres")
|
||||
}
|
||||
|
||||
t.Run("ErrorWithoutLicense", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testutil.Context(t, testutil.WaitLong)
|
||||
|
||||
@@ -89,10 +89,6 @@ func TestBlockNonBrowser(t *testing.T) {
|
||||
func TestReinitializeAgent(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("dbmem cannot currently claim a workspace")
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("test startup script is not supported on windows")
|
||||
}
|
||||
|
||||
@@ -660,10 +660,6 @@ func TestWorkspaceQuota(t *testing.T) {
|
||||
func TestWorkspaceSerialization(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("Serialization errors only occur in postgres")
|
||||
}
|
||||
|
||||
db, _ := dbtestutil.NewDB(t)
|
||||
|
||||
user := dbgen.User(t, db, database.User{})
|
||||
|
||||
@@ -534,10 +534,6 @@ func TestCreateUserWorkspace(t *testing.T) {
|
||||
t.Run("ClaimPrebuild", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("dbmem cannot currently claim a workspace")
|
||||
}
|
||||
|
||||
client, db, user := coderdenttest.NewWithDatabase(t, &coderdenttest.Options{
|
||||
Options: &coderdtest.Options{
|
||||
DeploymentValues: coderdtest.DeploymentValues(t),
|
||||
@@ -845,10 +841,6 @@ func TestWorkspaceAutobuild(t *testing.T) {
|
||||
t.Run("NoDeadlock", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skipf("Skipping non-postgres run")
|
||||
}
|
||||
|
||||
var (
|
||||
ticker = make(chan time.Time)
|
||||
statCh = make(chan autobuild.Stats)
|
||||
@@ -1654,10 +1646,6 @@ func TestWorkspaceAutobuild(t *testing.T) {
|
||||
t.Run("NextStartAtIsNullifiedOnScheduleChange", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("this test uses triggers so does not work with dbmem.go")
|
||||
}
|
||||
|
||||
var (
|
||||
tickCh = make(chan time.Time)
|
||||
statsCh = make(chan autobuild.Stats)
|
||||
@@ -1781,10 +1769,6 @@ func TestTemplateDoesNotAllowUserAutostop(t *testing.T) {
|
||||
func TestPrebuildsAutobuild(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
t.Skip("this test requires postgres")
|
||||
}
|
||||
|
||||
getRunningPrebuilds := func(
|
||||
t *testing.T,
|
||||
ctx context.Context,
|
||||
|
||||
Reference in New Issue
Block a user