Skip to content

Commit ea145b8

Browse files
committed
first commit: hugodutka/dbmem-enterprise-cli
1 parent e0fb15e commit ea145b8

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

enterprise/cli/server_dbcrypt_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ import (
2424
//
2525
// nolint: paralleltest // use of t.Setenv
2626
func TestServerDBCrypt(t *testing.T) {
27-
if !dbtestutil.WillUsePostgres() {
28-
t.Skip("this test requires a postgres instance")
29-
}
30-
3127
ctx, cancel := context.WithCancel(context.Background())
3228
t.Cleanup(cancel)
3329

enterprise/cli/server_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,20 @@ import (
1212

1313
"github.com/coder/coder/v2/cli/clitest"
1414
"github.com/coder/coder/v2/cli/config"
15+
"github.com/coder/coder/v2/coderd/database/dbtestutil"
1516
"github.com/coder/coder/v2/enterprise/cli"
1617
"github.com/coder/coder/v2/testutil"
1718
)
1819

20+
func dbArg(t *testing.T) string {
21+
if !dbtestutil.WillUsePostgres() {
22+
return "--in-memory"
23+
}
24+
dbURL, err := dbtestutil.Open(t)
25+
require.NoError(t, err)
26+
return "--postgres-url=" + dbURL
27+
}
28+
1929
// TestServer runs the enterprise server command
2030
// and waits for /healthz to return "OK".
2131
func TestServer_Single(t *testing.T) {
@@ -27,9 +37,10 @@ func TestServer_Single(t *testing.T) {
2737
var root cli.RootCmd
2838
cmd, err := root.Command(root.EnterpriseSubcommands())
2939
require.NoError(t, err)
40+
3041
inv, cfg := clitest.NewWithCommand(t, cmd,
3142
"server",
32-
"--in-memory",
43+
dbArg(t),
3344
"--http-address", ":0",
3445
"--access-url", "http://example.com",
3546
)

0 commit comments

Comments
 (0)