Skip to content

Commit cebd630

Browse files
Merge pull request #20264 from smarterclayton/retry_multicast
Multicast test needs to wait for NetNamespace to be created
2 parents 91d2909 + a343b46 commit cebd630

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/extended/networking/multicast.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package networking
33
import (
44
"fmt"
55
"regexp"
6+
"time"
67

78
"github.com/openshift/origin/pkg/network"
89
networkapi "github.com/openshift/origin/pkg/network/apis/network"
@@ -11,7 +12,9 @@ import (
1112
testutil "github.com/openshift/origin/test/util"
1213

1314
kapiv1 "k8s.io/api/core/v1"
15+
"k8s.io/apimachinery/pkg/api/errors"
1416
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
17+
"k8s.io/apimachinery/pkg/util/wait"
1518
e2e "k8s.io/kubernetes/test/e2e/framework"
1619

1720
. "github.com/onsi/ginkgo"
@@ -54,7 +57,17 @@ func makeNamespaceMulticastEnabled(ns *kapiv1.Namespace) {
5457
clientConfig, err := testutil.GetClusterAdminClientConfig(testexutil.KubeConfigPath())
5558
networkClient := networkclient.NewForConfigOrDie(clientConfig)
5659
expectNoError(err)
57-
netns, err := networkClient.Network().NetNamespaces().Get(ns.Name, metav1.GetOptions{})
60+
var netns *networkapi.NetNamespace
61+
err = wait.Poll(time.Second, 2*time.Minute, func() (bool, error) {
62+
netns, err = networkClient.Network().NetNamespaces().Get(ns.Name, metav1.GetOptions{})
63+
if err != nil {
64+
if errors.IsNotFound(err) {
65+
return false, nil
66+
}
67+
return false, err
68+
}
69+
return true, nil
70+
})
5871
expectNoError(err)
5972
if netns.Annotations == nil {
6073
netns.Annotations = make(map[string]string, 1)

0 commit comments

Comments
 (0)