mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
Fix lint and failing tests
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
|||||||
// that no lock was acquired; callers must treat a nil file as "proceed
|
// that no lock was acquired; callers must treat a nil file as "proceed
|
||||||
// without lock" rather than "lock held by someone else."
|
// without lock" rather than "lock held by someone else."
|
||||||
func Lock(_ context.Context, _ string) (*os.File, error) {
|
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.
|
// Unlock is a no-op on non-Unix platforms.
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ func TestMetrics_RoundTripper(t *testing.T) {
|
|||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
rt := m.RoundTripper(test.roundTripper)
|
rt := m.RoundTripper(test.roundTripper)
|
||||||
res, err := rt.RoundTrip(test.request)
|
res, err := rt.RoundTrip(test.request)
|
||||||
|
if res != nil && res.Body != nil {
|
||||||
|
defer res.Body.Close()
|
||||||
|
}
|
||||||
if diff := cmp.Diff(test.err, err); diff != "" {
|
if diff := cmp.Diff(test.err, err); diff != "" {
|
||||||
t.Errorf("Incorrect error (-want +got):\n%s", diff)
|
t.Errorf("Incorrect error (-want +got):\n%s", diff)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ func TestIntegration_ProxyConnection_HappyPath(t *testing.T) {
|
|||||||
stream, err := client.GetMappingUpdate(ctx, &proto.GetMappingUpdateRequest{
|
stream, err := client.GetMappingUpdate(ctx, &proto.GetMappingUpdateRequest{
|
||||||
ProxyId: "test-proxy-1",
|
ProxyId: "test-proxy-1",
|
||||||
Version: "test-v1",
|
Version: "test-v1",
|
||||||
Address: "https://test.proxy.io",
|
Address: "test.proxy.io",
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ func TestIntegration_ProxyConnection_SendsClusterAddress(t *testing.T) {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
clusterAddress := "https://test.proxy.io"
|
clusterAddress := "test.proxy.io"
|
||||||
|
|
||||||
stream, err := client.GetMappingUpdate(ctx, &proto.GetMappingUpdateRequest{
|
stream, err := client.GetMappingUpdate(ctx, &proto.GetMappingUpdateRequest{
|
||||||
ProxyId: "test-proxy-cluster",
|
ProxyId: "test-proxy-cluster",
|
||||||
@@ -328,7 +328,7 @@ func TestIntegration_ProxyConnection_Reconnect_ReceivesSameConfig(t *testing.T)
|
|||||||
|
|
||||||
client := proto.NewProxyServiceClient(conn)
|
client := proto.NewProxyServiceClient(conn)
|
||||||
|
|
||||||
clusterAddress := "https://test.proxy.io"
|
clusterAddress := "test.proxy.io"
|
||||||
proxyID := "test-proxy-reconnect"
|
proxyID := "test-proxy-reconnect"
|
||||||
|
|
||||||
// Helper to receive all mappings from a stream
|
// Helper to receive all mappings from a stream
|
||||||
@@ -401,7 +401,7 @@ func TestIntegration_ProxyConnection_ReconnectDoesNotDuplicateState(t *testing.T
|
|||||||
authMw := auth.NewMiddleware(logger, nil)
|
authMw := auth.NewMiddleware(logger, nil)
|
||||||
proxyHandler := proxy.NewReverseProxy(nil, "auto", nil, logger)
|
proxyHandler := proxy.NewReverseProxy(nil, "auto", nil, logger)
|
||||||
|
|
||||||
clusterAddress := "https://test.proxy.io"
|
clusterAddress := "test.proxy.io"
|
||||||
proxyID := "test-proxy-idempotent"
|
proxyID := "test-proxy-idempotent"
|
||||||
|
|
||||||
var addMappingCalls atomic.Int32
|
var addMappingCalls atomic.Int32
|
||||||
@@ -497,7 +497,7 @@ func TestIntegration_ProxyConnection_MultipleProxiesReceiveUpdates(t *testing.T)
|
|||||||
setup := setupIntegrationTest(t)
|
setup := setupIntegrationTest(t)
|
||||||
defer setup.cleanup()
|
defer setup.cleanup()
|
||||||
|
|
||||||
clusterAddress := "https://test.proxy.io"
|
clusterAddress := "test.proxy.io"
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
var mu sync.Mutex
|
var mu sync.Mutex
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
|
import log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
func AddSyslogHook() {
|
func AddSyslogHook() {
|
||||||
// The syslog package is not available for Windows. This adapter is needed
|
// The syslog package is not available for Windows. This adapter is needed
|
||||||
// to handle windows build.
|
// to handle windows build.
|
||||||
|
|||||||
Reference in New Issue
Block a user