@@ -179,6 +179,10 @@ func TestUpdateUpstreamServers(t *testing.T) {
179179								},
180180							},
181181						},
182+ 						{
183+ 							Name :      "empty-upstream" ,
184+ 							Endpoints : []resolver.Endpoint {},
185+ 						},
182186					},
183187					StreamUpstreams : []dataplane.Upstream {
184188						{
@@ -212,6 +216,20 @@ func TestUpdateUpstreamServers(t *testing.T) {
212216							},
213217						},
214218					},
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+ 					},
215233					{
216234						Action : & pb.NGINXPlusAction_UpdateStreamServers {
217235							UpdateStreamServers : & pb.UpdateStreamServers {
@@ -234,13 +252,14 @@ func TestUpdateUpstreamServers(t *testing.T) {
234252				g .Expect (fakeBroadcaster .SendCallCount ()).To (Equal (0 ))
235253			} else  if  test .buildUpstreams  {
236254				g .Expect (deployment .GetNGINXPlusActions ()).To (Equal (expActions ))
237- 				g .Expect (fakeBroadcaster .SendCallCount ()).To (Equal (2 ))
255+ 				g .Expect (fakeBroadcaster .SendCallCount ()).To (Equal (3 ))
238256			}
239257
240258			if  test .expErr  {
241259				expErr  :=  errors .Join (
242260					fmt .Errorf ("couldn't update upstream via the API: %w" , testErr ),
243261					fmt .Errorf ("couldn't update upstream via the API: %w" , testErr ),
262+ 					fmt .Errorf ("couldn't update upstream via the API: %w" , testErr ),
244263				)
245264
246265				g .Expect (deployment .GetLatestUpstreamError ()).To (Equal (expErr ))
0 commit comments