Skip to content

Commit

Permalink
Fix current tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakerouse committed Dec 5, 2023
1 parent f3373d8 commit bc82b30
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/client/artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions pkg/client/client_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc82b30

Please sign in to comment.