Skip to content

Commit ef95391

Browse files
Use the router's image instead of guessing in tests
Also use a consistent prefix so we get good debug output
1 parent b7776a1 commit ef95391

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

pkg/router/controller/factory/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func (f *RouterControllerFactory) CreateRoutesSharedInformer() kcache.SharedInde
236236
return nil, err
237237
}
238238
if f.RouteModifierFn != nil {
239-
watch.Filter(w, func(in watch.Event) (watch.Event, bool) {
239+
w = watch.Filter(w, func(in watch.Event) (watch.Event, bool) {
240240
if route, ok := in.Object.(*routeapi.Route); ok {
241241
f.RouteModifierFn(route)
242242
}

test/extended/router/scoped.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,28 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
3939
if routes, _ := client.List(metav1.ListOptions{}); routes != nil {
4040
outputIngress(routes.Items...)
4141
}
42-
exutil.DumpPodLogsStartingWith("scoped-router", oc)
42+
exutil.DumpPodLogsStartingWith("router-", oc)
4343
}
4444
})
4545

46-
oc = exutil.NewCLI("scoped-router", exutil.KubeConfigPath())
46+
oc = exutil.NewCLI("router-scoped", exutil.KubeConfigPath())
4747

4848
g.BeforeEach(func() {
4949
ns = oc.Namespace()
5050

51-
imagePrefix := os.Getenv("OS_IMAGE_PREFIX")
52-
if len(imagePrefix) == 0 {
53-
imagePrefix = "openshift/origin"
51+
image := os.Getenv("OS_IMAGE_PREFIX")
52+
if len(image) == 0 {
53+
image = "openshift/origin"
5454
}
55-
err := oc.AsAdmin().Run("new-app").Args("-f", configPath, "-p", "IMAGE="+imagePrefix+"-haproxy-router").Execute()
55+
image += "-haproxy-router"
56+
57+
if dc, err := oc.AdminAppsClient().Apps().DeploymentConfigs("default").Get("router", metav1.GetOptions{}); err == nil {
58+
if len(dc.Spec.Template.Spec.Containers) > 0 && dc.Spec.Template.Spec.Containers[0].Image != "" {
59+
image = dc.Spec.Template.Spec.Containers[0].Image
60+
}
61+
}
62+
63+
err := oc.AsAdmin().Run("new-app").Args("-f", configPath, "-p", "IMAGE="+image).Execute()
5664
o.Expect(err).NotTo(o.HaveOccurred())
5765
})
5866

@@ -67,7 +75,7 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
6775

6876
var routerIP string
6977
err := wait.Poll(time.Second, changeTimeoutSeconds*time.Second, func() (bool, error) {
70-
pod, err := oc.KubeFramework().ClientSet.CoreV1().Pods(oc.KubeFramework().Namespace.Name).Get("scoped-router", metav1.GetOptions{})
78+
pod, err := oc.KubeFramework().ClientSet.CoreV1().Pods(oc.KubeFramework().Namespace.Name).Get("router-scoped", metav1.GetOptions{})
7179
if err != nil {
7280
return false, err
7381
}

test/extended/router/unprivileged.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
6363

6464
var routerIP string
6565
err := wait.Poll(time.Second, changeTimeoutSeconds*time.Second, func() (bool, error) {
66-
pod, err := oc.KubeFramework().ClientSet.CoreV1().Pods(oc.KubeFramework().Namespace.Name).Get("scoped-router", metav1.GetOptions{})
66+
pod, err := oc.KubeFramework().ClientSet.CoreV1().Pods(oc.KubeFramework().Namespace.Name).Get("router-scoped", metav1.GetOptions{})
6767
if err != nil {
6868
return false, err
6969
}

test/extended/testdata/bindata.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/extended/testdata/scoped-router.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ objects:
1010
- apiVersion: v1
1111
kind: Pod
1212
metadata:
13-
name: scoped-router
13+
name: router-scoped
1414
labels:
15-
test: scoped-router
15+
test: router-scoped
1616
spec:
1717
terminationGracePeriodSeconds: 1
1818
containers:

0 commit comments

Comments
 (0)