From bc82b308a579a907889b07de8014d8610b5d7bd9 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Tue, 5 Dec 2023 17:16:58 -0500 Subject: [PATCH] Fix current tests. --- pkg/client/artifact_test.go | 2 +- pkg/client/client_v2_test.go | 18 +++++++++--------- pkg/client/log_test.go | 2 +- pkg/client/store_test.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/client/artifact_test.go b/pkg/client/artifact_test.go index 3fc109d..33c3301 100644 --- a/pkg/client/artifact_test.go +++ b/pkg/client/artifact_test.go @@ -55,7 +55,7 @@ func TestArtifact(t *testing.T) { var errs []error ctx, cancel := context.WithCancel(context.Background()) defer cancel() - client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())) + client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))) storeErrors(ctx, client, &errs, &errsMu) var unitsMu sync.Mutex diff --git a/pkg/client/client_v2_test.go b/pkg/client/client_v2_test.go index e4a5649..019989b 100644 --- a/pkg/client/client_v2_test.go +++ b/pkg/client/client_v2_test.go @@ -50,7 +50,7 @@ func TestRPCErrorRetryTimer(t *testing.T) { defer listener.Close() go rejectingListener(listener) - client := NewV2(listener.Addr().String(), mock.NewID(), VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())) + client := NewV2(listener.Addr().String(), mock.NewID(), VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))) assert.NoError(t, client.Start(context.Background())) // We expect one error each from checkinRoundTrip and actionRoundTrip. @@ -159,7 +159,7 @@ func TestClientV2_Checkin_Initial(t *testing.T) { var errs []error ctx, cancel := context.WithCancel(context.Background()) defer cancel() - invalidClient := NewV2(fmt.Sprintf(":%d", srv.Port), mock.NewID(), VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())) + invalidClient := NewV2(fmt.Sprintf(":%d", srv.Port), mock.NewID(), VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))) storeErrors(ctx, invalidClient, &errs, &errsMu) require.NoError(t, invalidClient.Start(ctx)) defer invalidClient.Stop() @@ -186,7 +186,7 @@ func TestClientV2_Checkin_Initial(t *testing.T) { Meta: map[string]string{ "key": "value", }, - }, grpc.WithTransportCredentials(insecure.NewCredentials())) + }, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))) storeErrors(ctx, validClient, &errs2, &errs2Mu) // receive the units @@ -378,7 +378,7 @@ func TestClientV2_Checkin_UnitState(t *testing.T) { var errs []error ctx, cancel := context.WithCancel(context.Background()) defer cancel() - client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())).(*clientV2) + client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))).(*clientV2) storeErrors(ctx, client, &errs, &errsMu) // receive the units @@ -509,7 +509,7 @@ func TestClientV2_Actions(t *testing.T) { var errs []error ctx, cancel := context.WithCancel(context.Background()) defer cancel() - client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())) + client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))) storeErrors(ctx, client, &errs, &errsMu) var unitsMu sync.Mutex @@ -827,7 +827,7 @@ func TestClientV2_Checkin_FeatureFlags(t *testing.T) { var errs []error ctx, cancel := context.WithCancel(context.Background()) defer cancel() - client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())).(*clientV2) + client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))).(*clientV2) client.minCheckTimeout = 100 * time.Millisecond // otherwise the test will run for too long storeErrors(ctx, client, &errs, &errsMu) @@ -987,7 +987,7 @@ func TestClientV2_Checkin_APMConfig(t *testing.T) { var errs []error ctx, cancel := context.WithCancel(context.Background()) defer cancel() - client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())).(*clientV2) + client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))).(*clientV2) storeErrors(ctx, client, &errs, &errsMu) var uca unitChangesAccumulator @@ -1166,7 +1166,7 @@ func TestClientV2_Checkin_Component(t *testing.T) { defer cancel() serverAddr := fmt.Sprintf(":%d", srv.Port) - client := NewV2(serverAddr, token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())).(*clientV2) + client := NewV2(serverAddr, token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))).(*clientV2) client.minCheckTimeout = 100 * time.Millisecond // otherwise the test will run for too long storeErrors(ctx, client, &errs, &errsMu) @@ -1255,7 +1255,7 @@ func setupClientForDiagnostics(ctx context.Context, t *testing.T) (*Unit, V2, mo var errsMu sync.Mutex var errs []error - client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())) + client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))) storeErrors(context.Background(), client, &errs, &errsMu) var unitsMu sync.Mutex diff --git a/pkg/client/log_test.go b/pkg/client/log_test.go index 26a1a12..aedba23 100644 --- a/pkg/client/log_test.go +++ b/pkg/client/log_test.go @@ -53,7 +53,7 @@ func TestLog(t *testing.T) { var errs []error ctx, cancel := context.WithCancel(context.Background()) defer cancel() - client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())) + client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))) storeErrors(ctx, client, &errs, &errsMu) var unitsMu sync.Mutex diff --git a/pkg/client/store_test.go b/pkg/client/store_test.go index 690c98d..7176900 100644 --- a/pkg/client/store_test.go +++ b/pkg/client/store_test.go @@ -55,7 +55,7 @@ func TestStore(t *testing.T) { var errs []error ctx, cancel := context.WithCancel(context.Background()) defer cancel() - client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, grpc.WithTransportCredentials(insecure.NewCredentials())) + client := NewV2(fmt.Sprintf(":%d", srv.Port), token, VersionInfo{}, WithGRPCDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials()))) storeErrors(ctx, client, &errs, &errsMu) var unitsMu sync.Mutex