Skip to content

Commit 01c7c86

Browse files
variable names
1 parent ab4f7d1 commit 01c7c86

File tree

14 files changed

+57
-55
lines changed

14 files changed

+57
-55
lines changed

internal/xds/balancer/clusterresolver/e2e_test/aggregate_cluster_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737
"google.golang.org/grpc/internal/testutils/pickfirst"
3838
"google.golang.org/grpc/internal/testutils/xds/e2e"
3939
"google.golang.org/grpc/internal/xds/bootstrap"
40-
xds_client "google.golang.org/grpc/internal/xds/clients/xdsclient"
40+
ixdsclient "google.golang.org/grpc/internal/xds/clients/xdsclient"
4141
"google.golang.org/grpc/internal/xds/xdsclient"
4242
"google.golang.org/grpc/internal/xds/xdsclient/xdsresource/version"
4343
"google.golang.org/grpc/peer"
@@ -1186,8 +1186,8 @@ func (s) TestAggregateCluster_Fallback_EDS_ResourceNotFound(t *testing.T) {
11861186
if err != nil {
11871187
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bootstrapContents), err)
11881188
}
1189-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
1190-
defer SetOriginalWatchExpiryTimeout()
1189+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
1190+
defer revertWatchExpiryTimeout()
11911191
pool := xdsclient.NewPool(config)
11921192
xdsClient, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
11931193
if err != nil {

internal/xds/balancer/clusterresolver/e2e_test/eds_impl_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import (
4141
rrutil "google.golang.org/grpc/internal/testutils/roundrobin"
4242
"google.golang.org/grpc/internal/testutils/xds/e2e"
4343
"google.golang.org/grpc/internal/xds/bootstrap"
44-
xds_client "google.golang.org/grpc/internal/xds/clients/xdsclient"
44+
ixdsclient "google.golang.org/grpc/internal/xds/clients/xdsclient"
4545
"google.golang.org/grpc/internal/xds/xdsclient"
4646
"google.golang.org/grpc/internal/xds/xdsclient/xdsresource/version"
4747
"google.golang.org/grpc/peer"
@@ -1102,8 +1102,8 @@ func (s) TestEDS_ResourceNotFound(t *testing.T) {
11021102
if err != nil {
11031103
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bc), err)
11041104
}
1105-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
1106-
defer SetOriginalWatchExpiryTimeout()
1105+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
1106+
defer revertWatchExpiryTimeout()
11071107
pool := xdsclient.NewPool(config)
11081108
xdsClient, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
11091109
if err != nil {

internal/xds/clients/xdsclient/xdsclient.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ func New(config Config) (*XDSClient, error) {
117117
}
118118

119119
// SetWatchExpiryTimeoutForTesting override the default watch expiry timeout
120-
// with provided timeout value and returns a function to reset the timeout to the
121-
// original value.
120+
// with provided timeout value and returns a function to reset the timeout to
121+
// the original value.
122+
//
123+
// Note: This function should not be called concurrently and must be called
124+
// before any RPCs to avoid race conditions.
122125
func SetWatchExpiryTimeoutForTesting(watchExpiryTimeout time.Duration) func() {
123126
originalWatchTimeout := xdsclientinternal.WatchExpiryTimeout
124127
if watchExpiryTimeout == 0 {

internal/xds/resolver/xds_resolver_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
"google.golang.org/grpc/internal/testutils/xds/e2e"
4141
"google.golang.org/grpc/internal/xds/balancer/clustermanager"
4242
"google.golang.org/grpc/internal/xds/bootstrap"
43-
xds_client "google.golang.org/grpc/internal/xds/clients/xdsclient"
43+
ixdsclient "google.golang.org/grpc/internal/xds/clients/xdsclient"
4444
"google.golang.org/grpc/internal/xds/httpfilter"
4545
rinternal "google.golang.org/grpc/internal/xds/resolver/internal"
4646
"google.golang.org/grpc/internal/xds/xdsclient"
@@ -268,8 +268,8 @@ func (s) TestResolverCloseClosesXDSClient(t *testing.T) {
268268
if err != nil {
269269
t.Fatalf("Failed to create an xDS client pool: %v", err)
270270
}
271-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestTimeout)
272-
defer SetOriginalWatchExpiryTimeout()
271+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestTimeout)
272+
defer revertWatchExpiryTimeout()
273273
c, cancel, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
274274
return c, sync.OnceFunc(func() {
275275
close(closeCh)

internal/xds/xdsclient/metrics_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"google.golang.org/grpc/internal/testutils/stats"
3131
"google.golang.org/grpc/internal/testutils/xds/e2e"
3232
"google.golang.org/grpc/internal/xds/bootstrap"
33-
xds_client "google.golang.org/grpc/internal/xds/clients/xdsclient"
33+
ixdsclient "google.golang.org/grpc/internal/xds/clients/xdsclient"
3434
"google.golang.org/grpc/internal/xds/xdsclient/xdsresource"
3535

3636
v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
@@ -96,8 +96,8 @@ func (s) TestResourceUpdateMetrics(t *testing.T) {
9696
if err != nil {
9797
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bootstrapContents), err)
9898
}
99-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
100-
defer SetOriginalWatchExpiryTimeout()
99+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
100+
defer revertWatchExpiryTimeout()
101101
pool := NewPool(config)
102102
client, close, err := pool.NewClientForTesting(OptionsForTesting{
103103
Name: t.Name(),
@@ -199,8 +199,8 @@ func (s) TestServerFailureMetrics_BeforeResponseRecv(t *testing.T) {
199199
if err != nil {
200200
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bootstrapContents), err)
201201
}
202-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
203-
defer SetOriginalWatchExpiryTimeout()
202+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
203+
defer revertWatchExpiryTimeout()
204204
pool := NewPool(config)
205205
client, close, err := pool.NewClientForTesting(OptionsForTesting{
206206
Name: t.Name(),

internal/xds/xdsclient/pool.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ func (p *Pool) NewClientForTesting(opts OptionsForTesting) (XDSClient, func(), e
123123
if err != nil {
124124
return nil, nil, err
125125
}
126-
// c.SetWatchExpiryTimeoutForTesting(opts.WatchExpiryTimeout)
127126
return c, cancel, nil
128127
}
129128

internal/xds/xdsclient/tests/authority_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"google.golang.org/grpc/internal/testutils"
3131
"google.golang.org/grpc/internal/testutils/xds/e2e"
3232
"google.golang.org/grpc/internal/xds/bootstrap"
33-
xds_client "google.golang.org/grpc/internal/xds/clients/xdsclient"
33+
ixdsclient "google.golang.org/grpc/internal/xds/clients/xdsclient"
3434
xdstestutils "google.golang.org/grpc/internal/xds/testutils"
3535
"google.golang.org/grpc/internal/xds/xdsclient"
3636
"google.golang.org/grpc/internal/xds/xdsclient/xdsresource"
@@ -107,8 +107,8 @@ func setupForAuthorityTests(ctx context.Context, t *testing.T) (*testutils.Liste
107107
if err != nil {
108108
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bootstrapContents), err)
109109
}
110-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
111-
defer SetOriginalWatchExpiryTimeout()
110+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
111+
defer revertWatchExpiryTimeout()
112112
pool := xdsclient.NewPool(config)
113113
client, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
114114
if err != nil {

internal/xds/xdsclient/tests/cds_watchers_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
"google.golang.org/grpc/internal/testutils"
3535
"google.golang.org/grpc/internal/testutils/xds/e2e"
3636
"google.golang.org/grpc/internal/xds/bootstrap"
37-
xds_client "google.golang.org/grpc/internal/xds/clients/xdsclient"
37+
ixdsclient "google.golang.org/grpc/internal/xds/clients/xdsclient"
3838
"google.golang.org/grpc/internal/xds/xdsclient"
3939
"google.golang.org/grpc/internal/xds/xdsclient/xdsresource"
4040

@@ -649,8 +649,8 @@ func (s) TestCDSWatch_ExpiryTimerFiresBeforeResponse(t *testing.T) {
649649
if err != nil {
650650
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bc), err)
651651
}
652-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
653-
defer SetOriginalWatchExpiryTimeout()
652+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
653+
defer revertWatchExpiryTimeout()
654654
pool := xdsclient.NewPool(config)
655655
client, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
656656
if err != nil {
@@ -691,8 +691,8 @@ func (s) TestCDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
691691
if err != nil {
692692
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bc), err)
693693
}
694-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
695-
defer SetOriginalWatchExpiryTimeout()
694+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
695+
defer revertWatchExpiryTimeout()
696696
pool := xdsclient.NewPool(config)
697697
client, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
698698
if err != nil {

internal/xds/xdsclient/tests/eds_watchers_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
"google.golang.org/grpc/internal/testutils/xds/e2e"
3535
"google.golang.org/grpc/internal/xds/bootstrap"
3636
"google.golang.org/grpc/internal/xds/clients"
37-
xds_client "google.golang.org/grpc/internal/xds/clients/xdsclient"
37+
ixdsclient "google.golang.org/grpc/internal/xds/clients/xdsclient"
3838
"google.golang.org/grpc/internal/xds/xdsclient"
3939
"google.golang.org/grpc/internal/xds/xdsclient/xdsresource"
4040
"google.golang.org/protobuf/types/known/wrapperspb"
@@ -736,8 +736,8 @@ func (s) TestEDSWatch_ExpiryTimerFiresBeforeResponse(t *testing.T) {
736736
if err != nil {
737737
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bc), err)
738738
}
739-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
740-
defer SetOriginalWatchExpiryTimeout()
739+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
740+
defer revertWatchExpiryTimeout()
741741
pool := xdsclient.NewPool(config)
742742
client, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
743743
if err != nil {
@@ -779,8 +779,8 @@ func (s) TestEDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
779779
if err != nil {
780780
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bc), err)
781781
}
782-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
783-
defer SetOriginalWatchExpiryTimeout()
782+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
783+
defer revertWatchExpiryTimeout()
784784
pool := xdsclient.NewPool(config)
785785
client, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
786786
if err != nil {

internal/xds/xdsclient/tests/lds_watchers_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
"google.golang.org/grpc/internal/testutils"
3535
"google.golang.org/grpc/internal/testutils/xds/e2e"
3636
"google.golang.org/grpc/internal/xds/bootstrap"
37-
xds_client "google.golang.org/grpc/internal/xds/clients/xdsclient"
37+
ixdsclient "google.golang.org/grpc/internal/xds/clients/xdsclient"
3838
"google.golang.org/grpc/internal/xds/xdsclient"
3939
"google.golang.org/grpc/internal/xds/xdsclient/xdsresource"
4040

@@ -701,8 +701,8 @@ func (s) TestLDSWatch_ExpiryTimerFiresBeforeResponse(t *testing.T) {
701701
if err != nil {
702702
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bc), err)
703703
}
704-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
705-
defer SetOriginalWatchExpiryTimeout()
704+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
705+
defer revertWatchExpiryTimeout()
706706
pool := xdsclient.NewPool(config)
707707
client, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
708708
if err != nil {
@@ -743,8 +743,8 @@ func (s) TestLDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
743743
if err != nil {
744744
t.Fatalf("Failed to parse bootstrap contents: %s, %v", string(bc), err)
745745
}
746-
SetOriginalWatchExpiryTimeout := xds_client.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
747-
defer SetOriginalWatchExpiryTimeout()
746+
revertWatchExpiryTimeout := ixdsclient.SetWatchExpiryTimeoutForTesting(defaultTestWatchExpiryTimeout)
747+
defer revertWatchExpiryTimeout()
748748
pool := xdsclient.NewPool(config)
749749
client, close, err := pool.NewClientForTesting(xdsclient.OptionsForTesting{Name: t.Name()})
750750
if err != nil {

0 commit comments

Comments
 (0)