Skip to content

Commit 11cdb4a

Browse files
authored
Merge pull request #424 from kubernetes-sigs/multi-nodeport-test
Added another nodeport to the GetServiceNodePort to validate some old…
2 parents de3eb41 + de7699b commit 11cdb4a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

pkg/controller/alb-controller_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,11 @@ func TestALBController_GetServiceNodePort(t *testing.T) {
282282
serviceStore.Add(&api.Service{
283283
ObjectMeta: metav1.ObjectMeta{Name: "service1"},
284284
Spec: api.ServiceSpec{
285-
Type: api.ServiceTypeNodePort,
286-
Ports: []api.ServicePort{{Port: 4000, NodePort: 8000}},
285+
Type: api.ServiceTypeNodePort,
286+
Ports: []api.ServicePort{
287+
{Port: 4000, NodePort: 8000},
288+
{Port: 4002, NodePort: 8020},
289+
},
287290
},
288291
})
289292
serviceStore.Add(&api.Service{
@@ -299,7 +302,12 @@ func TestALBController_GetServiceNodePort(t *testing.T) {
299302
},
300303
}
301304

302-
np, err := ac.GetServiceNodePort("service1", 4000)
305+
np, err := ac.GetServiceNodePort("service1", 4002)
306+
if *np != 8020 {
307+
t.Errorf("Expected node port for service1 to be 8020")
308+
}
309+
310+
np, err = ac.GetServiceNodePort("service1", 4000)
303311
if *np != 8000 {
304312
t.Errorf("Expected node port for service1 to be 8000")
305313
}

0 commit comments

Comments
 (0)