Skip to content

Commit 3f1d3d0

Browse files
committed
Fix version string parsing
1 parent 544338d commit 3f1d3d0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cli/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ func Server(dflags *codersdk.DeploymentFlags, newAPI func(context.Context, *code
403403
if err != nil {
404404
return xerrors.Errorf("scan version: %w", err)
405405
}
406+
versionStr = strings.Split(versionStr, " ")[0]
406407
if semver.Compare("v"+versionStr, "v13") < 0 {
407408
return xerrors.New("PostgreSQL version must be v13.0.0 or higher!")
408409
}

cli/server_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ func TestServer(t *testing.T) {
6060
"--postgres-url", connectionURL,
6161
"--cache-dir", t.TempDir(),
6262
)
63+
pty := ptytest.New(t)
64+
root.SetOutput(pty.Output())
65+
root.SetErr(pty.Output())
6366
errC := make(chan error, 1)
6467
go func() {
6568
errC <- root.ExecuteContext(ctx)
@@ -669,7 +672,7 @@ func waitAccessURL(t *testing.T, cfg config.Root) *url.URL {
669672
require.Eventually(t, func() bool {
670673
rawURL, err = cfg.URL().Read()
671674
return err == nil && rawURL != ""
672-
}, testutil.WaitLong, testutil.IntervalFast, "failed to get access URL")
675+
}, time.Minute, testutil.IntervalFast, "failed to get access URL")
673676

674677
accessURL, err := url.Parse(rawURL)
675678
require.NoError(t, err, "failed to parse access URL")

0 commit comments

Comments
 (0)