Skip to content

Commit 7238ab1

Browse files
authored
Allow empty nodeID (#8476)
1 parent 9186ebd commit 7238ab1

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

xds/internal/clients/xdsclient/xdsclient.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ type XDSClient struct {
101101
// New returns a new xDS Client configured with the provided config.
102102
func New(config Config) (*XDSClient, error) {
103103
switch {
104-
case config.Node.ID == "":
105-
return nil, errors.New("xdsclient: node ID is empty")
106104
case config.ResourceTypes == nil:
107105
return nil, errors.New("xdsclient: resource types map is nil")
108106
case config.TransportBuilder == nil:

xds/internal/clients/xdsclient/xdsclient_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ func (s) TestXDSClient_New(t *testing.T) {
3636
config Config
3737
wantErr string
3838
}{
39-
{
40-
name: "empty node ID",
41-
config: Config{},
42-
wantErr: "node ID is empty",
43-
},
4439
{
4540
name: "nil resource types",
4641
config: Config{
@@ -75,6 +70,16 @@ func (s) TestXDSClient_New(t *testing.T) {
7570
},
7671
wantErr: "",
7772
},
73+
{
74+
name: "success with servers and empty nodeID",
75+
config: Config{
76+
Node: clients.Node{ID: ""},
77+
ResourceTypes: map[string]ResourceType{xdsresource.V3ListenerURL: listenerType},
78+
TransportBuilder: grpctransport.NewBuilder(configs),
79+
Servers: []ServerConfig{{ServerIdentifier: clients.ServerIdentifier{ServerURI: "dummy-server"}}},
80+
},
81+
wantErr: "",
82+
},
7883
{
7984
name: "success with authorities",
8085
config: Config{

0 commit comments

Comments
 (0)