From 281487c742057ce22df37a63d3c8f79c7eb1556d Mon Sep 17 00:00:00 2001 From: Easwar Swaminathan Date: Fri, 27 Dec 2019 19:15:37 +0000 Subject: [PATCH] Review comments #1 --- xds/internal/client/cds_test.go | 4 ++-- xds/internal/client/client_test.go | 6 +++--- xds/internal/client/eds_test.go | 2 +- xds/internal/client/lds_test.go | 2 +- xds/internal/client/rds_test.go | 6 +++--- xds/internal/client/testutil_test.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xds/internal/client/cds_test.go b/xds/internal/client/cds_test.go index 6f81d1a2b85c..156026699b2e 100644 --- a/xds/internal/client/cds_test.go +++ b/xds/internal/client/cds_test.go @@ -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 @@ -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 ( diff --git a/xds/internal/client/client_test.go b/xds/internal/client/client_test.go index bb04c40e1913..d74d6c8efa0e 100644 --- a/xds/internal/client/client_test.go +++ b/xds/internal/client/client_test.go @@ -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 @@ -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 @@ -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 diff --git a/xds/internal/client/eds_test.go b/xds/internal/client/eds_test.go index 0719d00e2a9a..70afd655b33f 100644 --- a/xds/internal/client/eds_test.go +++ b/xds/internal/client/eds_test.go @@ -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) } diff --git a/xds/internal/client/lds_test.go b/xds/internal/client/lds_test.go index 7f8a857cdce2..9eee4e89617a 100644 --- a/xds/internal/client/lds_test.go +++ b/xds/internal/client/lds_test.go @@ -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) } diff --git a/xds/internal/client/rds_test.go b/xds/internal/client/rds_test.go index ce2d7d514afd..a947fc180f89 100644 --- a/xds/internal/client/rds_test.go +++ b/xds/internal/client/rds_test.go @@ -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 { @@ -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 @@ -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) { diff --git a/xds/internal/client/testutil_test.go b/xds/internal/client/testutil_test.go index 1312e9a59488..2fbc7183923a 100644 --- a/xds/internal/client/testutil_test.go +++ b/xds/internal/client/testutil_test.go @@ -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()