Skip to content

Commit ed09ae9

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

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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)