From a8af5d713c3900c8e38a09051ee2a47a114736f8 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Wed, 11 Dec 2024 22:24:04 -0500 Subject: [PATCH] fix Signed-off-by: Yuri Shkuro --- cmd/internal/flags/admin.go | 2 +- cmd/internal/flags/admin_test.go | 2 +- cmd/internal/flags/service_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/internal/flags/admin.go b/cmd/internal/flags/admin.go index afb5d501074..6078fb97c3b 100644 --- a/cmd/internal/flags/admin.go +++ b/cmd/internal/flags/admin.go @@ -115,7 +115,7 @@ func (s *AdminServer) serveWithListener(l net.Listener) (err error) { recoveryHandler(s.mux), ) if err != nil { - return err + return fmt.Errorf("failed to create admin server: %w", err) } errorLog, _ := zap.NewStdLogAt(s.logger, zapcore.ErrorLevel) s.server.ErrorLog = errorLog diff --git a/cmd/internal/flags/admin_test.go b/cmd/internal/flags/admin_test.go index f892974d5e5..8d83e46d99c 100644 --- a/cmd/internal/flags/admin_test.go +++ b/cmd/internal/flags/admin_test.go @@ -70,7 +70,7 @@ func TestAdminFailToServe(t *testing.T) { require.NoError(t, adminServer.initFromViper(v, logger)) adminServer.serveWithListener(l) - defer adminServer.Close() + t.Cleanup(func() { assert.NoError(t, adminServer.Close()) }) waitForEqual(t, healthcheck.Broken, func() any { return adminServer.HC().Get() }) diff --git a/cmd/internal/flags/service_test.go b/cmd/internal/flags/service_test.go index f50a2bbe97f..4157b1c7c6c 100644 --- a/cmd/internal/flags/service_test.go +++ b/cmd/internal/flags/service_test.go @@ -50,7 +50,7 @@ func TestStartErrors(t *testing.T) { { name: "bad admin TLS", flags: []string{"--admin.http.tls.enabled=true", "--admin.http.tls.cert=invalid-cert"}, - expErr: "cannot initialize admin server", + expErr: "cannot start the admin server: failed to load TLS config", }, { name: "bad host:port",