Skip to content

Commit

Permalink
[federation_target_parsing] fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl committed Oct 28, 2021
1 parent f8a17b5 commit cfba88f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions xds/internal/resolver/xds_resolver.go
Expand Up @@ -121,10 +121,10 @@ func (b *xdsResolverBuilder) Build(t resolver.Target, cc resolver.ClientConn, op
if a == nil {
return nil, fmt.Errorf("xds: authority %q is not found in the bootstrap file", authority)
}
if a.ClientListenerResourceNameTemplate == "" {
// This check will never be true, because
if a.ClientListenerResourceNameTemplate != "" {
// This check will never be false, because
// ClientListenerResourceNameTemplate is required to start with
// xdstp://, and has a default value if unset.
// xdstp://, and has a default value (not an empty string) if unset.
template = a.ClientListenerResourceNameTemplate
}
}
Expand Down
10 changes: 5 additions & 5 deletions xds/internal/resolver/xds_resolver_test.go
Expand Up @@ -292,7 +292,7 @@ func (s) TestXDSResolverResourceNameToWatch(t *testing.T) {
want string
}{
{
name: "default %s, old style",
name: "default %s old style",
bc: &bootstrap.Config{
ClientDefaultListenerResourceNameTemplate: "%s",
},
Expand All @@ -302,7 +302,7 @@ func (s) TestXDSResolverResourceNameToWatch(t *testing.T) {
want: targetStr,
},
{
name: "old style, no percent encoding",
name: "old style no percent encoding",
bc: &bootstrap.Config{
ClientDefaultListenerResourceNameTemplate: "/path/to/%s",
},
Expand All @@ -312,7 +312,7 @@ func (s) TestXDSResolverResourceNameToWatch(t *testing.T) {
want: "/path/to/" + targetStr,
},
{
name: "new style, with %s",
name: "new style with %s",
bc: &bootstrap.Config{
ClientDefaultListenerResourceNameTemplate: "xdstp://authority.com/%s",
Authorities: nil,
Expand All @@ -323,7 +323,7 @@ func (s) TestXDSResolverResourceNameToWatch(t *testing.T) {
want: "xdstp://authority.com/0.0.0.0:8080",
},
{
name: "new style, percent encoding",
name: "new style percent encoding",
bc: &bootstrap.Config{
ClientDefaultListenerResourceNameTemplate: "xdstp://authority.com/%s",
Authorities: nil,
Expand All @@ -334,7 +334,7 @@ func (s) TestXDSResolverResourceNameToWatch(t *testing.T) {
want: "xdstp://authority.com/%5B::1%5D:8080",
},
{
name: "new style, different authority",
name: "new style different authority",
bc: &bootstrap.Config{
ClientDefaultListenerResourceNameTemplate: "xdstp://authority.com/%s",
Authorities: map[string]*bootstrap.Authority{
Expand Down

0 comments on commit cfba88f

Please sign in to comment.