Skip to content

Commit 3f446a1

Browse files
E2E: block esvc test until EIP is assigned to aid debug
This will result in a more meaningful error message if the EIP is not assigned. Signed-off-by: Martin Kennelly <[email protected]>
1 parent f1384dc commit 3f446a1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/e2e/egress_services.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"golang.org/x/sync/errgroup"
2424
v1 "k8s.io/api/core/v1"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26+
"k8s.io/apimachinery/pkg/util/wait"
2627
"k8s.io/client-go/kubernetes"
2728
"k8s.io/kubernetes/test/e2e/framework"
2829
e2ekubectl "k8s.io/kubernetes/test/e2e/framework/kubectl"
@@ -792,6 +793,30 @@ spec:
792793
e2ekubectl.RunKubectlOrDie("default", "delete", "eip", "egress-svc-test-eip")
793794
}()
794795

796+
ginkgo.By("wait until egress IP is assigned")
797+
err = wait.PollImmediate(retryInterval, retryTimeout, func() (bool, error) {
798+
egressIPs := egressIPs{}
799+
egressIPStdout, err := e2ekubectl.RunKubectl("default", "get", "eip", "-o", "json")
800+
if err != nil {
801+
framework.Logf("Error: failed to get the EgressIP object, err: %v", err)
802+
return false, nil
803+
}
804+
err = json.Unmarshal([]byte(egressIPStdout), &egressIPs)
805+
if err != nil {
806+
panic(err.Error())
807+
}
808+
if len(egressIPs.Items) == 0 {
809+
return false, nil
810+
}
811+
if len(egressIPs.Items) > 1 {
812+
framework.Failf("Didn't expect to retrieve more than one egress IP during the execution of this test, saw: %v", len(egressIPs.Items))
813+
}
814+
return len(egressIPs.Items[0].Status.Items) > 0, nil
815+
})
816+
if err != nil {
817+
framework.Failf("Error: expected to have 1 egress IP assignment, got: 0")
818+
}
819+
795820
ginkgo.By("Verifying the pods reach the external container with the service's ingress ip")
796821
for _, pod := range pods {
797822
gomega.Eventually(func() error {

0 commit comments

Comments
 (0)