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:
Hugo Dutka
2025-10-23 14:24:54 +02:00
committed by GitHub
parent 4244b20823
commit e62c5db678
33 changed files with 26 additions and 380 deletions
-10
View File
@@ -33,9 +33,6 @@ func TestMetrics(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it relies on business-logic only implemented in the database")
}
ctx := dbauthz.AsSystemRestricted(testutil.Context(t, testutil.WaitSuperLong))
store, pubsub := dbtestutil.NewDB(t)
@@ -390,13 +387,6 @@ func TestInflightDispatchesMetric(t *testing.T) {
func TestCustomMethodMetricCollection(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
// UpdateNotificationTemplateMethodByID only makes sense with a real database.
t.Skip("This test requires postgres; it relies on business-logic only implemented in the database")
}
ctx := dbauthz.AsSystemRestricted(testutil.Context(t, testutil.WaitSuperLong))
store, pubsub := dbtestutil.NewDB(t)
logger := testutil.Logger(t)
@@ -66,11 +66,6 @@ func TestMain(m *testing.M) {
func TestBasicNotificationRoundtrip(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it relies on business-logic only implemented in the database")
}
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
store, pubsub := dbtestutil.NewDB(t)
logger := testutil.Logger(t)
@@ -278,11 +273,6 @@ func TestWebhookDispatch(t *testing.T) {
func TestBackpressure(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it relies on business-logic only implemented in the database")
}
store, pubsub := dbtestutil.NewDB(t)
logger := testutil.Logger(t)
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitShort))
@@ -407,11 +397,6 @@ func TestBackpressure(t *testing.T) {
func TestRetries(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it relies on business-logic only implemented in the database")
}
const maxAttempts = 3
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
store, pubsub := dbtestutil.NewDB(t)
@@ -507,11 +492,6 @@ func TestRetries(t *testing.T) {
func TestExpiredLeaseIsRequeued(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it relies on business-logic only implemented in the database")
}
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
store, pubsub := dbtestutil.NewDB(t)
logger := testutil.Logger(t)
@@ -751,10 +731,6 @@ func enumerateAllTemplates(t *testing.T) ([]string, error) {
func TestNotificationTemplates_Golden(t *testing.T) {
t.Parallel()
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it relies on the notification templates added by migrations in the database")
}
const (
username = "bob"
password = "🤫"
@@ -1705,10 +1681,6 @@ func normalizeGoldenWebhook(content []byte) []byte {
func TestDisabledByDefaultBeforeEnqueue(t *testing.T) {
t.Parallel()
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it is testing business-logic implemented in the database")
}
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
store, _ := dbtestutil.NewDB(t)
logbuf := strings.Builder{}
@@ -1732,11 +1704,6 @@ func TestDisabledByDefaultBeforeEnqueue(t *testing.T) {
func TestDisabledBeforeEnqueue(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it is testing business-logic implemented in the database")
}
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
store, _ := dbtestutil.NewDB(t)
logbuf := strings.Builder{}
@@ -1771,11 +1738,6 @@ func TestDisabledBeforeEnqueue(t *testing.T) {
func TestDisabledAfterEnqueue(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it is testing business-logic implemented in the database")
}
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
store, pubsub := dbtestutil.NewDB(t)
logger := testutil.Logger(t)
@@ -1827,11 +1789,6 @@ func TestDisabledAfterEnqueue(t *testing.T) {
func TestCustomNotificationMethod(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it relies on business-logic only implemented in the database")
}
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
store, pubsub := dbtestutil.NewDB(t)
logger := testutil.Logger(t)
@@ -1929,12 +1886,6 @@ func TestCustomNotificationMethod(t *testing.T) {
func TestNotificationsTemplates(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
// Notification system templates are only served from the database and not dbmem at this time.
t.Skip("This test requires postgres; it relies on business-logic only implemented in the database")
}
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
api := coderdtest.New(t, createOpts(t))
@@ -1966,11 +1917,6 @@ func createOpts(t *testing.T) *coderdtest.Options {
func TestNotificationDuplicates(t *testing.T) {
t.Parallel()
// SETUP
if !dbtestutil.WillUsePostgres() {
t.Skip("This test requires postgres; it is testing the dedupe hash trigger in the database")
}
ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong))
store, pubsub := dbtestutil.NewDB(t)
logbuf := strings.Builder{}