Skip to content

Commit

Permalink
[federation_target_parsing] add test for client close
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl committed Nov 3, 2021
1 parent 03bc08e commit f8ea440
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions xds/internal/resolver/xds_resolver_test.go
Expand Up @@ -193,13 +193,20 @@ func (s) TestResolverBuilder(t *testing.T) {
func (s) TestResolverBuilder_xdsCredsBootstrapMismatch(t *testing.T) {
// Fake out the xdsClient creation process by providing a fake, which does
// not have any certificate provider configuration.
fc := fakeclient.NewClient()
fc.SetBootstrapConfig(&bootstrap.Config{})
oldClientMaker := newXDSClient
newXDSClient = func() (xdsclient.XDSClient, error) {
fc := fakeclient.NewClient()
fc.SetBootstrapConfig(&bootstrap.Config{})
return fc, nil
}
defer func() { newXDSClient = oldClientMaker }()
defer func() {
select {
case <-time.After(defaultTestTimeout):
t.Fatalf("timeout waiting for close")
case <-fc.Closed.Done():
}
}()

builder := resolver.Get(xdsScheme)
if builder == nil {
Expand Down

0 comments on commit f8ea440

Please sign in to comment.