Skip to content

Commit 17fa3f4

Browse files
committed
511 problems left...
* Some server.go fixes
1 parent 1fdf0d0 commit 17fa3f4

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

cli/server.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ flags, and YAML configuration. The precedence is as follows:
350350
shouldCoderTrace := cfg.Telemetry.Enable.Value() && !isTest()
351351
// Only override if telemetryTraceEnable was specifically set.
352352
// By default we want it to be controlled by telemetryEnable.
353-
ifinv.ParsedFlags().Changed("telemetry-trace") {
353+
if inv.ParsedFlags().Changed("telemetry-trace") {
354354
shouldCoderTrace = cfg.Telemetry.Trace.Value()
355355
}
356356

@@ -456,7 +456,7 @@ flags, and YAML configuration. The precedence is as follows:
456456

457457
// DEPRECATED: This redirect used to default to true.
458458
// It made more sense to have the redirect be opt-in.
459-
if os.Getenv("CODER_TLS_REDIRECT_HTTP") == "true" ||inv.ParsedFlags().Changed("tls-redirect-http-to-https") {
459+
if os.Getenv("CODER_TLS_REDIRECT_HTTP") == "true" || inv.ParsedFlags().Changed("tls-redirect-http-to-https") {
460460
cmd.PrintErr(cliui.Styles.Warn.Render("WARN:") + " --tls-redirect-http-to-https is deprecated, please use --redirect-to-access-url instead\n")
461461
cfg.RedirectToAccessURL = cfg.TLS.RedirectHTTP
462462
}
@@ -1075,7 +1075,7 @@ flags, and YAML configuration. The precedence is as follows:
10751075
go func() {
10761076
defer wg.Done()
10771077

1078-
if ok, _ :=inv.ParsedFlags().GetBool(varVerbose); ok {
1078+
if ok, _ := inv.ParsedFlags().GetBool(varVerbose); ok {
10791079
cmd.Printf("Shutting down provisioner daemon %d...\n", id)
10801080
}
10811081
err := shutdownWithTimeout(provisionerDaemon.Shutdown, 5*time.Second)
@@ -1088,7 +1088,7 @@ flags, and YAML configuration. The precedence is as follows:
10881088
cmd.PrintErrf("Close provisioner daemon %d: %s\n", id, err)
10891089
return
10901090
}
1091-
if ok, _ :=inv.ParsedFlags().GetBool(varVerbose); ok {
1091+
if ok, _ := inv.ParsedFlags().GetBool(varVerbose); ok {
10921092
cmd.Printf("Gracefully shut down provisioner daemon %d\n", id)
10931093
}
10941094
}()
@@ -1146,7 +1146,7 @@ flags, and YAML configuration. The precedence is as follows:
11461146

11471147
cfg := createConfig(cmd)
11481148
logger := slog.Make(sloghuman.Sink(inv.Stderr))
1149-
if ok, _ :=inv.ParsedFlags().GetBool(varVerbose); ok {
1149+
if ok, _ := inv.ParsedFlags().GetBool(varVerbose); ok {
11501150
logger = logger.Leveled(slog.LevelDebug)
11511151
}
11521152

cli/server_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func TestServer(t *testing.T) {
406406
"--tls-key-file", keyPath,
407407
"--cache-dir", t.TempDir(),
408408
)
409-
clitest.Start(ctx, t, root)
409+
clitest.Start(t, root.WithContext(ctx))
410410

411411
// Verify HTTPS
412412
accessURL := waitAccessURL(t, cfg)
@@ -446,7 +446,7 @@ func TestServer(t *testing.T) {
446446
)
447447
pty := ptytest.New(t)
448448
root.Stdout = pty.Output()
449-
clitest.Start(ctx, t, root)
449+
clitest.Start(t, root.WithContext(ctx))
450450

451451
accessURL := waitAccessURL(t, cfg)
452452
require.Equal(t, "https", accessURL.Scheme)
@@ -864,7 +864,7 @@ func TestServer(t *testing.T) {
864864
pty := ptytest.New(t)
865865
root.Stdout = pty.Output()
866866
root.Stderr = pty.Output()
867-
clitest.Start(ctx, t, root)
867+
clitest.Start(t, root.WithContext(ctx))
868868

869869
pty.ExpectMatch("is deprecated")
870870

@@ -894,7 +894,7 @@ func TestServer(t *testing.T) {
894894
pty := ptytest.New(t)
895895
root.Stdout = pty.Output()
896896
root.Stderr = pty.Output()
897-
clitest.Start(ctx, t, root)
897+
clitest.Start(t, root.WithContext(ctx))
898898

899899
pty.ExpectMatch("is deprecated")
900900

@@ -1230,7 +1230,7 @@ func TestServer(t *testing.T) {
12301230
"--access-url", "http://example.com",
12311231
"--log-human", fiName,
12321232
)
1233-
clitest.Start(context.Background(), t, root)
1233+
clitest.Start(t, root)
12341234

12351235
waitFile(t, fiName, testutil.WaitShort)
12361236
})
@@ -1247,7 +1247,7 @@ func TestServer(t *testing.T) {
12471247
"--access-url", "http://example.com",
12481248
"--log-human", fi,
12491249
)
1250-
clitest.Start(context.Background(), t, root)
1250+
clitest.Start(t, root)
12511251

12521252
waitFile(t, fi, testutil.WaitShort)
12531253
})
@@ -1264,7 +1264,7 @@ func TestServer(t *testing.T) {
12641264
"--access-url", "http://example.com",
12651265
"--log-json", fi,
12661266
)
1267-
clitest.Start(context.Background(), t, root)
1267+
clitest.Start(t, root)
12681268

12691269
waitFile(t, fi, testutil.WaitShort)
12701270
})
@@ -1319,7 +1319,7 @@ func TestServer(t *testing.T) {
13191319
// which can take a long time and end up failing the test.
13201320
// This is why we wait extra long below for server to listen on
13211321
// HTTP.
1322-
root, _ := clitest.New(t,
1322+
inv, _ := clitest.New(t,
13231323
"server",
13241324
"--verbose",
13251325
"--in-memory",
@@ -1332,10 +1332,10 @@ func TestServer(t *testing.T) {
13321332
// Attach pty so we get debug output from the command if this test
13331333
// fails.
13341334
pty := ptytest.New(t)
1335-
root.Stdout = pty.Output()
1336-
root.Stderr = pty.Output()
1335+
inv.Stdout = pty.Output()
1336+
inv.Stderr = pty.Output()
13371337

1338-
clitest.Start(ctx, t, root)
1338+
clitest.Start(t, inv)
13391339

13401340
// Wait for server to listen on HTTP, this is a good
13411341
// starting point for expecting logs.

0 commit comments

Comments
 (0)