Skip to content

Commit 6e6884f

Browse files
committed
xds: misc test cleanup (4/N)
1 parent 3adcd41 commit 6e6884f

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

internal/testutils/channel.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ const DefaultChanBufferSize = 1
2626

2727
// Channel wraps a generic channel and provides a timed receive operation.
2828
type Channel struct {
29-
// C is the underlying channel on which values sent using the SendXxx() methods are delivered.
30-
// Tests which cannot use ReceiveXxx() for whatever reasons can use C to read the values.
29+
// C is the underlying channel on which values sent using the SendXxx()
30+
// methods are delivered. Tests which cannot use ReceiveXxx() for whatever
31+
// reasons can use C to read the values.
3132
C chan any
3233
}
3334

test/xds/xds_client_federation_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,4 @@ func (s) TestFederation_UnknownAuthorityInReceivedResponse(t *testing.T) {
336336
if got, want := status.Code(err), codes.Unavailable; got != want {
337337
t.Fatalf("EmptyCall RPC returned status code: %v, want %v", got, want)
338338
}
339-
if wantErr := `failed to find authority "unknown-authority"`; !strings.Contains(err.Error(), wantErr) {
340-
t.Fatalf("EmptyCall RPC returned error: %v, want %v", err, wantErr)
341-
}
342339
}

xds/internal/xdsclient/tests/cds_watchers_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/google/go-cmp/cmp/cmpopts"
3131
"github.com/google/uuid"
3232
"google.golang.org/grpc/internal/grpcsync"
33+
"google.golang.org/grpc/internal/pretty"
3334
"google.golang.org/grpc/internal/testutils"
3435
"google.golang.org/grpc/internal/testutils/xds/e2e"
3536
"google.golang.org/grpc/internal/xds/bootstrap"
@@ -130,7 +131,7 @@ func verifyNoClusterUpdate(ctx context.Context, updateCh *testutils.Channel) err
130131
sCtx, sCancel := context.WithTimeout(ctx, defaultTestShortTimeout)
131132
defer sCancel()
132133
if u, err := updateCh.Receive(sCtx); err != context.DeadlineExceeded {
133-
return fmt.Errorf("received unexpected ClusterUpdate when expecting none: %v", u)
134+
return fmt.Errorf("received unexpected ClusterUpdate when expecting none: %s", pretty.ToJSON(u))
134135
}
135136
return nil
136137
}

xds/server_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,17 +697,16 @@ func (s) TestServeAndCloseDoNotRace(t *testing.T) {
697697
}
698698

699699
wg := sync.WaitGroup{}
700+
wg.Add(200)
700701
for i := 0; i < 100; i++ {
701702
server, err := NewGRPCServer(BootstrapContentsForTesting(generateBootstrapContents(t, uuid.NewString(), nonExistentManagementServer)))
702703
if err != nil {
703704
t.Fatalf("Failed to create an xDS enabled gRPC server: %v", err)
704705
}
705-
wg.Add(1)
706706
go func() {
707707
server.Serve(lis)
708708
wg.Done()
709709
}()
710-
wg.Add(1)
711710
go func() {
712711
server.Stop()
713712
wg.Done()

0 commit comments

Comments
 (0)