@@ -179,6 +179,10 @@ func TestUpdateUpstreamServers(t *testing.T) {
179
179
},
180
180
},
181
181
},
182
+ {
183
+ Name : "empty-upstream" ,
184
+ Endpoints : []resolver.Endpoint {},
185
+ },
182
186
},
183
187
StreamUpstreams : []dataplane.Upstream {
184
188
{
@@ -212,6 +216,20 @@ func TestUpdateUpstreamServers(t *testing.T) {
212
216
},
213
217
},
214
218
},
219
+ {
220
+ Action : & pb.NGINXPlusAction_UpdateHttpUpstreamServers {
221
+ UpdateHttpUpstreamServers : & pb.UpdateHTTPUpstreamServers {
222
+ HttpUpstreamName : "empty-upstream" ,
223
+ Servers : []* structpb.Struct {
224
+ {
225
+ Fields : map [string ]* structpb.Value {
226
+ "server" : structpb .NewStringValue ("unix:/var/run/nginx/nginx-503-server.sock" ),
227
+ },
228
+ },
229
+ },
230
+ },
231
+ },
232
+ },
215
233
{
216
234
Action : & pb.NGINXPlusAction_UpdateStreamServers {
217
235
UpdateStreamServers : & pb.UpdateStreamServers {
@@ -234,13 +252,14 @@ func TestUpdateUpstreamServers(t *testing.T) {
234
252
g .Expect (fakeBroadcaster .SendCallCount ()).To (Equal (0 ))
235
253
} else if test .buildUpstreams {
236
254
g .Expect (deployment .GetNGINXPlusActions ()).To (Equal (expActions ))
237
- g .Expect (fakeBroadcaster .SendCallCount ()).To (Equal (2 ))
255
+ g .Expect (fakeBroadcaster .SendCallCount ()).To (Equal (3 ))
238
256
}
239
257
240
258
if test .expErr {
241
259
expErr := errors .Join (
242
260
fmt .Errorf ("couldn't update upstream via the API: %w" , testErr ),
243
261
fmt .Errorf ("couldn't update upstream via the API: %w" , testErr ),
262
+ fmt .Errorf ("couldn't update upstream via the API: %w" , testErr ),
244
263
)
245
264
246
265
g .Expect (deployment .GetLatestUpstreamError ()).To (Equal (expErr ))
0 commit comments