Commit 14d98636 authored by Janet Kuo's avatar Janet Kuo

Fix broken redis example e2e tests

parent 8dee2b42
...@@ -13,7 +13,7 @@ spec: ...@@ -13,7 +13,7 @@ spec:
spec: spec:
containers: containers:
- name: redis - name: redis
image: kubernetes/redis:v2 image: kubernetes/redis:v1
ports: ports:
- containerPort: 6379 - containerPort: 6379
resources: resources:
......
...@@ -9,7 +9,7 @@ metadata: ...@@ -9,7 +9,7 @@ metadata:
spec: spec:
containers: containers:
- name: master - name: master
image: kubernetes/redis:v2 image: kubernetes/redis:v1
env: env:
- name: MASTER - name: MASTER
value: "true" value: "true"
...@@ -22,7 +22,7 @@ spec: ...@@ -22,7 +22,7 @@ spec:
- mountPath: /redis-master-data - mountPath: /redis-master-data
name: data name: data
- name: sentinel - name: sentinel
image: kubernetes/redis:v2 image: kubernetes/redis:v1
env: env:
- name: SENTINEL - name: SENTINEL
value: "true" value: "true"
......
...@@ -15,7 +15,7 @@ spec: ...@@ -15,7 +15,7 @@ spec:
spec: spec:
containers: containers:
- name: sentinel - name: sentinel
image: kubernetes/redis:v2 image: kubernetes/redis:v1
env: env:
- name: SENTINEL - name: SENTINEL
value: "true" value: "true"
......
...@@ -91,7 +91,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() { ...@@ -91,7 +91,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
framework.RunKubectlOrDie("create", "-f", sentinelServiceYaml, nsFlag) framework.RunKubectlOrDie("create", "-f", sentinelServiceYaml, nsFlag)
framework.RunKubectlOrDie("create", "-f", sentinelControllerYaml, nsFlag) framework.RunKubectlOrDie("create", "-f", sentinelControllerYaml, nsFlag)
framework.RunKubectlOrDie("create", "-f", controllerYaml, nsFlag) framework.RunKubectlOrDie("create", "-f", controllerYaml, nsFlag)
label := labels.SelectorFromSet(labels.Set(map[string]string{"name": sentinelRC})) label := labels.SelectorFromSet(labels.Set(map[string]string{sentinelRC: "true"}))
err = framework.WaitForPodsWithLabelRunning(c, ns, label) err = framework.WaitForPodsWithLabelRunning(c, ns, label)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
label = labels.SelectorFromSet(labels.Set(map[string]string{"name": redisRC})) label = labels.SelectorFromSet(labels.Set(map[string]string{"name": redisRC}))
...@@ -106,13 +106,21 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() { ...@@ -106,13 +106,21 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
By("checking up the services") By("checking up the services")
checkAllLogs := func() { checkAllLogs := func() {
forEachPod("name", "redis", func(pod api.Pod) { selectorKey, selectorValue := "name", redisRC
label := labels.SelectorFromSet(labels.Set(map[string]string{selectorKey: selectorValue}))
err = framework.WaitForPodsWithLabelRunning(c, ns, label)
Expect(err).NotTo(HaveOccurred())
forEachPod(selectorKey, selectorValue, func(pod api.Pod) {
if pod.Name != bootstrapPodName { if pod.Name != bootstrapPodName {
_, err := framework.LookForStringInLog(ns, pod.Name, "redis", expectedOnServer, serverStartTimeout) _, err := framework.LookForStringInLog(ns, pod.Name, "redis", expectedOnServer, serverStartTimeout)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
} }
}) })
forEachPod("name", "redis-sentinel", func(pod api.Pod) { selectorKey, selectorValue = sentinelRC, "true"
label = labels.SelectorFromSet(labels.Set(map[string]string{selectorKey: selectorValue}))
err = framework.WaitForPodsWithLabelRunning(c, ns, label)
Expect(err).NotTo(HaveOccurred())
forEachPod(selectorKey, selectorValue, func(pod api.Pod) {
if pod.Name != bootstrapPodName { if pod.Name != bootstrapPodName {
_, err := framework.LookForStringInLog(ns, pod.Name, "sentinel", expectedOnSentinel, serverStartTimeout) _, err := framework.LookForStringInLog(ns, pod.Name, "sentinel", expectedOnSentinel, serverStartTimeout)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
......
...@@ -3913,7 +3913,7 @@ func WaitForIngressAddress(c *client.Client, ns, ingName string, timeout time.Du ...@@ -3913,7 +3913,7 @@ func WaitForIngressAddress(c *client.Client, ns, ingName string, timeout time.Du
// Looks for the given string in the log of a specific pod container // Looks for the given string in the log of a specific pod container
func LookForStringInLog(ns, podName, container, expectedString string, timeout time.Duration) (result string, err error) { func LookForStringInLog(ns, podName, container, expectedString string, timeout time.Duration) (result string, err error) {
return LookForString(expectedString, timeout, func() string { return LookForString(expectedString, timeout, func() string {
return RunKubectlOrDie("log", podName, container, fmt.Sprintf("--namespace=%v", ns)) return RunKubectlOrDie("logs", podName, container, fmt.Sprintf("--namespace=%v", ns))
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment