Skip to content

Commit 4257ca0

Browse files
test(coderd/database): skip tests when PostgreSQL is unavailable
1 parent 5c49221 commit 4257ca0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

coderd/database/dbtestutil/postgres_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ func TestMain(m *testing.M) {
1919

2020
func TestOpen(t *testing.T) {
2121
t.Parallel()
22+
if !dbtestutil.WillUsePostgres() {
23+
t.Skip("this test requires postgres")
24+
}
2225

2326
connect, err := dbtestutil.Open(t)
2427
require.NoError(t, err)
@@ -33,6 +36,9 @@ func TestOpen(t *testing.T) {
3336

3437
func TestOpen_InvalidDBFrom(t *testing.T) {
3538
t.Parallel()
39+
if !dbtestutil.WillUsePostgres() {
40+
t.Skip("this test requires postgres")
41+
}
3642

3743
_, err := dbtestutil.Open(t, dbtestutil.WithDBFrom("__invalid__"))
3844
require.Error(t, err)
@@ -42,6 +48,9 @@ func TestOpen_InvalidDBFrom(t *testing.T) {
4248

4349
func TestOpen_ValidDBFrom(t *testing.T) {
4450
t.Parallel()
51+
if !dbtestutil.WillUsePostgres() {
52+
t.Skip("this test requires postgres")
53+
}
4554

4655
// first check if we can create a new template db
4756
dsn, err := dbtestutil.Open(t, dbtestutil.WithDBFrom(""))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy