Skip to content

Commit

Permalink
Review comments #1
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars committed Dec 27, 2019
1 parent 0627552 commit 281487c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions xds/internal/client/cds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func TestCDSCaching(t *testing.T) {
}
errCh := testutils.NewChannel()
go testCDSCaching(t, ops, errCh)
waitForNonNilErr(t, errCh)
waitForNilErr(t, errCh)
}

// TestCDSWatchExpiryTimer tests the case where the client does not receive an
Expand Down Expand Up @@ -407,7 +407,7 @@ func TestCDSWatchExpiryTimer(t *testing.T) {
if _, err := fakeServer.XDSRequestChan.Receive(); err != nil {
t.Fatalf("Timeout expired when expecting an CDS request")
}
waitForNonNilErr(t, callbackCh)
waitForNilErr(t, callbackCh)
}

var (
Expand Down
6 changes: 3 additions & 3 deletions xds/internal/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestWatchService(t *testing.T) {
t.Fatalf("Timeout expired when expecting an RDS request")
}
fakeServer.XDSResponseChan <- &fakeserver.Response{Resp: goodRDSResponse1}
waitForNonNilErr(t, callbackCh)
waitForNilErr(t, callbackCh)
}

// TestWatchServiceWithNoResponseFromServer tests the case where the
Expand Down Expand Up @@ -196,7 +196,7 @@ func TestWatchServiceWithNoResponseFromServer(t *testing.T) {
if _, err := fakeServer.XDSRequestChan.Receive(); err != nil {
t.Fatalf("Timeout expired when expecting an LDS request")
}
waitForNonNilErr(t, callbackCh)
waitForNilErr(t, callbackCh)
}

// TestWatchServiceEmptyRDS tests the case where the underlying
Expand Down Expand Up @@ -247,7 +247,7 @@ func TestWatchServiceEmptyRDS(t *testing.T) {
t.Fatalf("Timeout expired when expecting an RDS request")
}
fakeServer.XDSResponseChan <- &fakeserver.Response{Resp: noVirtualHostsInRDSResponse}
waitForNonNilErr(t, callbackCh)
waitForNilErr(t, callbackCh)
}

// TestWatchServiceWithClientClose tests the case where xDS responses are
Expand Down
2 changes: 1 addition & 1 deletion xds/internal/client/eds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,5 +284,5 @@ func TestEDSWatchExpiryTimer(t *testing.T) {
if _, err := fakeServer.XDSRequestChan.Receive(); err != nil {
t.Fatalf("Timeout expired when expecting an CDS request")
}
waitForNonNilErr(t, callbackCh)
waitForNilErr(t, callbackCh)
}
2 changes: 1 addition & 1 deletion xds/internal/client/lds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,5 @@ func TestLDSWatchExpiryTimer(t *testing.T) {
if _, err := fakeServer.XDSRequestChan.Receive(); err != nil {
t.Fatalf("Timeout expired when expecting an LDS request")
}
waitForNonNilErr(t, callbackCh)
waitForNilErr(t, callbackCh)
}
6 changes: 3 additions & 3 deletions xds/internal/client/rds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func doLDS(t *testing.T, v2c *v2Client, fakeServer *fakeserver.Server) {
}

fakeServer.XDSResponseChan <- &fakeserver.Response{Resp: goodLDSResponse1}
waitForNonNilErr(t, cbCh)
waitForNilErr(t, cbCh)

// Read the LDS ack, to clear RequestChan for following tests.
if _, err := fakeServer.XDSRequestChan.Receive(); err != nil {
Expand Down Expand Up @@ -420,7 +420,7 @@ func TestRDSCaching(t *testing.T) {
}
errCh := testutils.NewChannel()
go testRDSCaching(t, ops, errCh)
waitForNonNilErr(t, errCh)
waitForNilErr(t, errCh)
}

// TestRDSWatchExpiryTimer tests the case where the client does not receive an
Expand Down Expand Up @@ -458,7 +458,7 @@ func TestRDSWatchExpiryTimer(t *testing.T) {
if _, err := fakeServer.XDSRequestChan.Receive(); err != nil {
t.Fatalf("Timeout expired when expecting an RDS request")
}
waitForNonNilErr(t, callbackCh)
waitForNilErr(t, callbackCh)
}

func TestHostFromTarget(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions xds/internal/client/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ func startServerAndGetCC(t *testing.T) (*fakeserver.Server, *grpc.ClientConn, fu
}
}

// waitForNonNilErr waits for a non-nil error value to be received on the
// waitForNilErr waits for a nil error value to be received on the
// provided channel.
func waitForNonNilErr(t *testing.T, ch *testutils.Channel) {
func waitForNilErr(t *testing.T, ch *testutils.Channel) {
t.Helper()

val, err := ch.Receive()
Expand Down

0 comments on commit 281487c

Please sign in to comment.