Fix lint and failing tests

This commit is contained in:
Viktor Liu
2026-02-12 18:19:13 +01:00
parent 57d3ee5aac
commit eea7687ddf
4 changed files with 11 additions and 6 deletions

View File

@@ -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.

View File

@@ -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)
}

View File

@@ -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

View File

@@ -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.