From eea7687ddfe9352a856d35f7fd7379dffc6ff1a8 Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Thu, 12 Feb 2026 18:19:13 +0100 Subject: [PATCH] Fix lint and failing tests --- proxy/internal/flock/flock_other.go | 2 +- proxy/internal/metrics/metrics_test.go | 3 +++ proxy/management_integration_test.go | 10 +++++----- util/syslog_windows.go | 2 ++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/proxy/internal/flock/flock_other.go b/proxy/internal/flock/flock_other.go index c73e1e217..a3916a442 100644 --- a/proxy/internal/flock/flock_other.go +++ b/proxy/internal/flock/flock_other.go @@ -11,7 +11,7 @@ import ( // that no lock was acquired; callers must treat a nil file as "proceed // without lock" rather than "lock held by someone else." func Lock(_ context.Context, _ string) (*os.File, error) { - return nil, nil + return nil, nil //nolint:nilnil // intentional: nil file signals locking unsupported on this platform } // Unlock is a no-op on non-Unix platforms. diff --git a/proxy/internal/metrics/metrics_test.go b/proxy/internal/metrics/metrics_test.go index 72a429653..31e00ae64 100644 --- a/proxy/internal/metrics/metrics_test.go +++ b/proxy/internal/metrics/metrics_test.go @@ -53,6 +53,9 @@ func TestMetrics_RoundTripper(t *testing.T) { t.Run(name, func(t *testing.T) { rt := m.RoundTripper(test.roundTripper) res, err := rt.RoundTrip(test.request) + if res != nil && res.Body != nil { + defer res.Body.Close() + } if diff := cmp.Diff(test.err, err); diff != "" { t.Errorf("Incorrect error (-want +got):\n%s", diff) } diff --git a/proxy/management_integration_test.go b/proxy/management_integration_test.go index e2ddf4b75..e3ff74cb8 100644 --- a/proxy/management_integration_test.go +++ b/proxy/management_integration_test.go @@ -251,7 +251,7 @@ func TestIntegration_ProxyConnection_HappyPath(t *testing.T) { stream, err := client.GetMappingUpdate(ctx, &proto.GetMappingUpdateRequest{ ProxyId: "test-proxy-1", Version: "test-v1", - Address: "https://test.proxy.io", + Address: "test.proxy.io", }) require.NoError(t, err) @@ -293,7 +293,7 @@ func TestIntegration_ProxyConnection_SendsClusterAddress(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - clusterAddress := "https://test.proxy.io" + clusterAddress := "test.proxy.io" stream, err := client.GetMappingUpdate(ctx, &proto.GetMappingUpdateRequest{ ProxyId: "test-proxy-cluster", @@ -328,7 +328,7 @@ func TestIntegration_ProxyConnection_Reconnect_ReceivesSameConfig(t *testing.T) client := proto.NewProxyServiceClient(conn) - clusterAddress := "https://test.proxy.io" + clusterAddress := "test.proxy.io" proxyID := "test-proxy-reconnect" // Helper to receive all mappings from a stream @@ -401,7 +401,7 @@ func TestIntegration_ProxyConnection_ReconnectDoesNotDuplicateState(t *testing.T authMw := auth.NewMiddleware(logger, nil) proxyHandler := proxy.NewReverseProxy(nil, "auto", nil, logger) - clusterAddress := "https://test.proxy.io" + clusterAddress := "test.proxy.io" proxyID := "test-proxy-idempotent" var addMappingCalls atomic.Int32 @@ -497,7 +497,7 @@ func TestIntegration_ProxyConnection_MultipleProxiesReceiveUpdates(t *testing.T) setup := setupIntegrationTest(t) defer setup.cleanup() - clusterAddress := "https://test.proxy.io" + clusterAddress := "test.proxy.io" var wg sync.WaitGroup var mu sync.Mutex diff --git a/util/syslog_windows.go b/util/syslog_windows.go index a4120ef66..68fddfc5e 100644 --- a/util/syslog_windows.go +++ b/util/syslog_windows.go @@ -1,5 +1,7 @@ package util +import log "github.com/sirupsen/logrus" + func AddSyslogHook() { // The syslog package is not available for Windows. This adapter is needed // to handle windows build.