@@ -180,7 +180,7 @@ func verifyListenerUpdate(ctx context.Context, updateCh *testutils.Channel, want
180
180
return nil
181
181
}
182
182
183
- func verifyUnknownListenerError (ctx context.Context , updateCh * testutils.Channel , wantErr string ) error {
183
+ func verifyListenerError (ctx context.Context , updateCh * testutils.Channel , wantErr , wantNodeID string ) error {
184
184
u , err := updateCh .Receive (ctx )
185
185
if err != nil {
186
186
return fmt .Errorf ("timeout when waiting for a listener error from the management server: %v" , err )
@@ -189,6 +189,9 @@ func verifyUnknownListenerError(ctx context.Context, updateCh *testutils.Channel
189
189
if gotErr == nil || ! strings .Contains (gotErr .Error (), wantErr ) {
190
190
return fmt .Errorf ("update received with error: %v, want %q" , gotErr , wantErr )
191
191
}
192
+ if ! strings .Contains (gotErr .Error (), wantNodeID ) {
193
+ return fmt .Errorf ("update received with error: %v, want error with node ID: %q" , gotErr , wantNodeID )
194
+ }
192
195
return nil
193
196
}
194
197
@@ -1058,15 +1061,15 @@ func (s) TestLDSWatch_NACKError(t *testing.T) {
1058
1061
}
1059
1062
1060
1063
// Verify that the expected error is propagated to the existing watcher.
1061
- if err := verifyUnknownListenerError (ctx , lw .updateCh , wantListenerNACKErr ); err != nil {
1064
+ if err := verifyListenerError (ctx , lw .updateCh , wantListenerNACKErr , nodeID ); err != nil {
1062
1065
t .Fatal (err )
1063
1066
}
1064
1067
1065
1068
// Verify that the expected error is propagated to the new watcher as well.
1066
1069
lw2 := newListenerWatcher ()
1067
1070
ldsCancel2 := xdsresource .WatchListener (client , ldsName , lw2 )
1068
1071
defer ldsCancel2 ()
1069
- if err := verifyUnknownListenerError (ctx , lw2 .updateCh , wantListenerNACKErr ); err != nil {
1072
+ if err := verifyListenerError (ctx , lw2 .updateCh , wantListenerNACKErr , nodeID ); err != nil {
1070
1073
t .Fatal (err )
1071
1074
}
1072
1075
}
@@ -1138,7 +1141,7 @@ func (s) TestLDSWatch_ResourceCaching_NACKError(t *testing.T) {
1138
1141
}
1139
1142
1140
1143
// Verify that the expected error is propagated to the existing watcher.
1141
- if err := verifyUnknownListenerError (ctx , lw1 .updateCh , wantListenerNACKErr ); err != nil {
1144
+ if err := verifyListenerError (ctx , lw1 .updateCh , wantListenerNACKErr , nodeID ); err != nil {
1142
1145
t .Fatal (err )
1143
1146
}
1144
1147
@@ -1151,7 +1154,7 @@ func (s) TestLDSWatch_ResourceCaching_NACKError(t *testing.T) {
1151
1154
t .Fatal (err )
1152
1155
}
1153
1156
// Verify that the expected error is propagated to the existing watcher.
1154
- if err := verifyUnknownListenerError (ctx , lw2 .updateCh , wantListenerNACKErr ); err != nil {
1157
+ if err := verifyListenerError (ctx , lw2 .updateCh , wantListenerNACKErr , nodeID ); err != nil {
1155
1158
t .Fatal (err )
1156
1159
}
1157
1160
}
@@ -1229,7 +1232,7 @@ func (s) TestLDSWatch_PartialValid(t *testing.T) {
1229
1232
// Verify that the expected error is propagated to the watcher which
1230
1233
// requested for the bad resource.
1231
1234
// Verify that the expected error is propagated to the existing watcher.
1232
- if err := verifyUnknownListenerError (ctx , lw1 .updateCh , wantListenerNACKErr ); err != nil {
1235
+ if err := verifyListenerError (ctx , lw1 .updateCh , wantListenerNACKErr , nodeID ); err != nil {
1233
1236
t .Fatal (err )
1234
1237
}
1235
1238
0 commit comments