@@ -28,6 +28,7 @@ import (
28
28
"github.com/google/uuid"
29
29
"google.golang.org/grpc/credentials/insecure"
30
30
"google.golang.org/grpc/internal/testutils/xds/e2e"
31
+ "google.golang.org/grpc/internal/xds/clients"
31
32
"google.golang.org/grpc/internal/xds/clients/grpctransport"
32
33
"google.golang.org/grpc/internal/xds/clients/internal/testutils"
33
34
"google.golang.org/grpc/internal/xds/clients/xdsclient"
@@ -175,9 +176,34 @@ func (s) TestADS_WatchState_TimerFires(t *testing.T) {
175
176
// short resource expiry timeout.
176
177
nodeID := uuid .New ().String ()
177
178
configs := map [string ]grpctransport.Config {"insecure" : {Credentials : insecure .NewBundle ()}}
178
- overrideWatchExpiryTimeout (t , defaultTestWatchExpiryTimeout )
179
- client := createXDSClient (t , mgmtServer .Address , nodeID , grpctransport .NewBuilder (configs ))
180
-
179
+ resourceTypes := map [string ]xdsclient.ResourceType {xdsresource .V3ListenerURL : listenerType }
180
+ si := clients.ServerIdentifier {
181
+ ServerURI : mgmtServer .Address ,
182
+ Extensions : grpctransport.ServerIdentifierExtension {ConfigName : "insecure" },
183
+ }
184
+
185
+ xdsClientConfig := xdsclient.Config {
186
+ Servers : []xdsclient.ServerConfig {{ServerIdentifier : si }},
187
+ Node : clients.Node {ID : nodeID , UserAgentName : "user-agent" , UserAgentVersion : "0.0.0.0" },
188
+ TransportBuilder : grpctransport .NewBuilder (configs ),
189
+ ResourceTypes : resourceTypes ,
190
+ // Xdstp resource names used in this test do not specify an
191
+ // authority. These will end up looking up an entry with the
192
+ // empty key in the authorities map. Having an entry with an
193
+ // empty key and empty configuration, results in these
194
+ // resources also using the top-level configuration.
195
+ Authorities : map [string ]xdsclient.Authority {
196
+ "" : {XDSServers : []xdsclient.ServerConfig {}},
197
+ },
198
+ WatchExpiryTimeout : defaultTestWatchExpiryTimeout ,
199
+ }
200
+
201
+ // Create an xDS client with the above config.
202
+ client , err := xdsclient .New (xdsClientConfig )
203
+ if err != nil {
204
+ t .Fatalf ("Failed to create xDS client: %v" , err )
205
+ }
206
+ t .Cleanup (func () { client .Close () })
181
207
// Create a watch for the first listener resource and verify that the timer
182
208
// is running and the watch state is `requested`.
183
209
const listenerName = "listener"
0 commit comments