diff --git a/enterprise/cli/server_test.go b/enterprise/cli/server_test.go index d913bc443c..7022f0d33b 100644 --- a/enterprise/cli/server_test.go +++ b/enterprise/cli/server_test.go @@ -12,10 +12,20 @@ import ( "github.com/coder/coder/v2/cli/clitest" "github.com/coder/coder/v2/cli/config" + "github.com/coder/coder/v2/coderd/database/dbtestutil" "github.com/coder/coder/v2/enterprise/cli" "github.com/coder/coder/v2/testutil" ) +func dbArg(t *testing.T) string { + if !dbtestutil.WillUsePostgres() { + return "--in-memory" + } + dbURL, err := dbtestutil.Open(t) + require.NoError(t, err) + return "--postgres-url=" + dbURL +} + // TestServer runs the enterprise server command // and waits for /healthz to return "OK". func TestServer_Single(t *testing.T) { @@ -27,9 +37,10 @@ func TestServer_Single(t *testing.T) { var root cli.RootCmd cmd, err := root.Command(root.EnterpriseSubcommands()) require.NoError(t, err) + inv, cfg := clitest.NewWithCommand(t, cmd, "server", - "--in-memory", + dbArg(t), "--http-address", ":0", "--access-url", "http://example.com", )