Commit 03180ec2 authored by SataQiu's avatar SataQiu

fix golint failures of test/e2e/apps

parent 01480140
...@@ -631,7 +631,6 @@ staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/flunder ...@@ -631,7 +631,6 @@ staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/flunder
staging/src/k8s.io/sample-controller/pkg/apis/samplecontroller staging/src/k8s.io/sample-controller/pkg/apis/samplecontroller
staging/src/k8s.io/sample-controller/pkg/apis/samplecontroller/v1alpha1 staging/src/k8s.io/sample-controller/pkg/apis/samplecontroller/v1alpha1
test/e2e test/e2e
test/e2e/apps
test/e2e/auth test/e2e/auth
test/e2e/autoscaling test/e2e/autoscaling
test/e2e/chaosmonkey test/e2e/chaosmonkey
......
...@@ -36,8 +36,8 @@ import ( ...@@ -36,8 +36,8 @@ import (
testutils "k8s.io/kubernetes/test/utils" testutils "k8s.io/kubernetes/test/utils"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
) )
// This test primarily checks 2 things: // This test primarily checks 2 things:
...@@ -52,14 +52,17 @@ const ( ...@@ -52,14 +52,17 @@ const (
restartTimeout = 10 * time.Minute restartTimeout = 10 * time.Minute
numPods = 10 numPods = 10
sshPort = 22 sshPort = 22
ADD = "ADD" // ADD represents the ADD event
DEL = "DEL" ADD = "ADD"
UPDATE = "UPDATE" // DEL represents the DEL event
DEL = "DEL"
// UPDATE represents the UPDATE event
UPDATE = "UPDATE"
) )
// restartDaemonConfig is a config to restart a running daemon on a node, and wait till // RestartDaemonConfig is a config to restart a running daemon on a node, and wait till
// it comes back up. It uses ssh to send a SIGTERM to the daemon. // it comes back up. It uses ssh to send a SIGTERM to the daemon.
type restartDaemonConfig struct { type RestartDaemonConfig struct {
nodeName string nodeName string
daemonName string daemonName string
healthzPort int healthzPort int
...@@ -67,12 +70,12 @@ type restartDaemonConfig struct { ...@@ -67,12 +70,12 @@ type restartDaemonConfig struct {
pollTimeout time.Duration pollTimeout time.Duration
} }
// NewRestartConfig creates a restartDaemonConfig for the given node and daemon. // NewRestartConfig creates a RestartDaemonConfig for the given node and daemon.
func NewRestartConfig(nodeName, daemonName string, healthzPort int, pollInterval, pollTimeout time.Duration) *restartDaemonConfig { func NewRestartConfig(nodeName, daemonName string, healthzPort int, pollInterval, pollTimeout time.Duration) *RestartDaemonConfig {
if !framework.ProviderIs("gce") { if !framework.ProviderIs("gce") {
framework.Logf("WARNING: SSH through the restart config might not work on %s", framework.TestContext.Provider) framework.Logf("WARNING: SSH through the restart config might not work on %s", framework.TestContext.Provider)
} }
return &restartDaemonConfig{ return &RestartDaemonConfig{
nodeName: nodeName, nodeName: nodeName,
daemonName: daemonName, daemonName: daemonName,
healthzPort: healthzPort, healthzPort: healthzPort,
...@@ -81,12 +84,12 @@ func NewRestartConfig(nodeName, daemonName string, healthzPort int, pollInterval ...@@ -81,12 +84,12 @@ func NewRestartConfig(nodeName, daemonName string, healthzPort int, pollInterval
} }
} }
func (r *restartDaemonConfig) String() string { func (r *RestartDaemonConfig) String() string {
return fmt.Sprintf("Daemon %v on node %v", r.daemonName, r.nodeName) return fmt.Sprintf("Daemon %v on node %v", r.daemonName, r.nodeName)
} }
// waitUp polls healthz of the daemon till it returns "ok" or the polling hits the pollTimeout // waitUp polls healthz of the daemon till it returns "ok" or the polling hits the pollTimeout
func (r *restartDaemonConfig) waitUp() { func (r *RestartDaemonConfig) waitUp() {
framework.Logf("Checking if %v is up by polling for a 200 on its /healthz endpoint", r) framework.Logf("Checking if %v is up by polling for a 200 on its /healthz endpoint", r)
healthzCheck := fmt.Sprintf( healthzCheck := fmt.Sprintf(
"curl -s -o /dev/null -I -w \"%%{http_code}\" http://localhost:%v/healthz", r.healthzPort) "curl -s -o /dev/null -I -w \"%%{http_code}\" http://localhost:%v/healthz", r.healthzPort)
...@@ -110,14 +113,14 @@ func (r *restartDaemonConfig) waitUp() { ...@@ -110,14 +113,14 @@ func (r *restartDaemonConfig) waitUp() {
} }
// kill sends a SIGTERM to the daemon // kill sends a SIGTERM to the daemon
func (r *restartDaemonConfig) kill() { func (r *RestartDaemonConfig) kill() {
framework.Logf("Killing %v", r) framework.Logf("Killing %v", r)
_, err := framework.NodeExec(r.nodeName, fmt.Sprintf("pgrep %v | xargs -I {} sudo kill {}", r.daemonName)) _, err := framework.NodeExec(r.nodeName, fmt.Sprintf("pgrep %v | xargs -I {} sudo kill {}", r.daemonName))
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
// Restart checks if the daemon is up, kills it, and waits till it comes back up // Restart checks if the daemon is up, kills it, and waits till it comes back up
func (r *restartDaemonConfig) restart() { func (r *RestartDaemonConfig) restart() {
r.waitUp() r.waitUp()
r.kill() r.kill()
r.waitUp() r.waitUp()
...@@ -191,7 +194,7 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() { ...@@ -191,7 +194,7 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() {
var stopCh chan struct{} var stopCh chan struct{}
var tracker *podTracker var tracker *podTracker
BeforeEach(func() { ginkgo.BeforeEach(func() {
// These tests require SSH // These tests require SSH
framework.SkipUnlessProviderIs(framework.ProvidersWithSSH...) framework.SkipUnlessProviderIs(framework.ProvidersWithSSH...)
ns = f.Namespace.Name ns = f.Namespace.Name
...@@ -206,7 +209,7 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() { ...@@ -206,7 +209,7 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() {
Replicas: numPods, Replicas: numPods,
CreatedPods: &[]*v1.Pod{}, CreatedPods: &[]*v1.Pod{},
} }
Expect(framework.RunRC(config)).NotTo(HaveOccurred()) gomega.Expect(framework.RunRC(config)).NotTo(gomega.HaveOccurred())
replacePods(*config.CreatedPods, existingPods) replacePods(*config.CreatedPods, existingPods)
stopCh = make(chan struct{}) stopCh = make(chan struct{})
...@@ -240,11 +243,11 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() { ...@@ -240,11 +243,11 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() {
go controller.Run(stopCh) go controller.Run(stopCh)
}) })
AfterEach(func() { ginkgo.AfterEach(func() {
close(stopCh) close(stopCh)
}) })
It("Controller Manager should not create/delete replicas across restart", func() { ginkgo.It("Controller Manager should not create/delete replicas across restart", func() {
// Requires master ssh access. // Requires master ssh access.
framework.SkipUnlessProviderIs("gce", "aws") framework.SkipUnlessProviderIs("gce", "aws")
...@@ -275,7 +278,7 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() { ...@@ -275,7 +278,7 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() {
} }
}) })
It("Scheduler should continue assigning pods to nodes across restart", func() { ginkgo.It("Scheduler should continue assigning pods to nodes across restart", func() {
// Requires master ssh access. // Requires master ssh access.
framework.SkipUnlessProviderIs("gce", "aws") framework.SkipUnlessProviderIs("gce", "aws")
...@@ -293,7 +296,7 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() { ...@@ -293,7 +296,7 @@ var _ = SIGDescribe("DaemonRestart [Disruptive]", func() {
framework.ExpectNoError(framework.ScaleRC(f.ClientSet, f.ScalesGetter, ns, rcName, numPods+5, true)) framework.ExpectNoError(framework.ScaleRC(f.ClientSet, f.ScalesGetter, ns, rcName, numPods+5, true))
}) })
It("Kubelet should not restart containers across restart", func() { ginkgo.It("Kubelet should not restart containers across restart", func() {
nodeIPs, err := framework.GetNodePublicIps(f.ClientSet) nodeIPs, err := framework.GetNodePublicIps(f.ClientSet)
framework.ExpectNoError(err) framework.ExpectNoError(err)
......
...@@ -20,8 +20,8 @@ import ( ...@@ -20,8 +20,8 @@ import (
"fmt" "fmt"
"time" "time"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
apps "k8s.io/api/apps/v1" apps "k8s.io/api/apps/v1"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
...@@ -48,16 +48,16 @@ var _ = SIGDescribe("DisruptionController", func() { ...@@ -48,16 +48,16 @@ var _ = SIGDescribe("DisruptionController", func() {
var ns string var ns string
var cs kubernetes.Interface var cs kubernetes.Interface
BeforeEach(func() { ginkgo.BeforeEach(func() {
cs = f.ClientSet cs = f.ClientSet
ns = f.Namespace.Name ns = f.Namespace.Name
}) })
It("should create a PodDisruptionBudget", func() { ginkgo.It("should create a PodDisruptionBudget", func() {
createPDBMinAvailableOrDie(cs, ns, intstr.FromString("1%")) createPDBMinAvailableOrDie(cs, ns, intstr.FromString("1%"))
}) })
It("should update PodDisruptionBudget status", func() { ginkgo.It("should update PodDisruptionBudget status", func() {
createPDBMinAvailableOrDie(cs, ns, intstr.FromInt(2)) createPDBMinAvailableOrDie(cs, ns, intstr.FromInt(2))
createPodsOrDie(cs, ns, 3) createPodsOrDie(cs, ns, 3)
...@@ -72,7 +72,7 @@ var _ = SIGDescribe("DisruptionController", func() { ...@@ -72,7 +72,7 @@ var _ = SIGDescribe("DisruptionController", func() {
} }
return pdb.Status.PodDisruptionsAllowed > 0, nil return pdb.Status.PodDisruptionsAllowed > 0, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
}) })
evictionCases := []struct { evictionCases := []struct {
...@@ -145,7 +145,7 @@ var _ = SIGDescribe("DisruptionController", func() { ...@@ -145,7 +145,7 @@ var _ = SIGDescribe("DisruptionController", func() {
if c.shouldDeny { if c.shouldDeny {
expectation = "should not allow an eviction" expectation = "should not allow an eviction"
} }
It(fmt.Sprintf("evictions: %s => %s", c.description, expectation), func() { ginkgo.It(fmt.Sprintf("evictions: %s => %s", c.description, expectation), func() {
if c.skipForBigClusters { if c.skipForBigClusters {
framework.SkipUnlessNodeCountIsAtMost(bigClusterSize - 1) framework.SkipUnlessNodeCountIsAtMost(bigClusterSize - 1)
} }
...@@ -179,7 +179,7 @@ var _ = SIGDescribe("DisruptionController", func() { ...@@ -179,7 +179,7 @@ var _ = SIGDescribe("DisruptionController", func() {
return false, nil return false, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
e := &policy.Eviction{ e := &policy.Eviction{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
...@@ -194,7 +194,7 @@ var _ = SIGDescribe("DisruptionController", func() { ...@@ -194,7 +194,7 @@ var _ = SIGDescribe("DisruptionController", func() {
time.Sleep(timeout) time.Sleep(timeout)
err = cs.CoreV1().Pods(ns).Evict(e) err = cs.CoreV1().Pods(ns).Evict(e)
Expect(err).Should(MatchError("Cannot evict pod as it would violate the pod's disruption budget.")) gomega.Expect(err).Should(gomega.MatchError("Cannot evict pod as it would violate the pod's disruption budget."))
} else { } else {
// Only wait for running pods in the "allow" case // Only wait for running pods in the "allow" case
// because one of shouldDeny cases relies on the // because one of shouldDeny cases relies on the
...@@ -207,11 +207,10 @@ var _ = SIGDescribe("DisruptionController", func() { ...@@ -207,11 +207,10 @@ var _ = SIGDescribe("DisruptionController", func() {
err = cs.CoreV1().Pods(ns).Evict(e) err = cs.CoreV1().Pods(ns).Evict(e)
if err != nil { if err != nil {
return false, nil return false, nil
} else {
return true, nil
} }
return true, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
}) })
} }
...@@ -229,7 +228,7 @@ func createPDBMinAvailableOrDie(cs kubernetes.Interface, ns string, minAvailable ...@@ -229,7 +228,7 @@ func createPDBMinAvailableOrDie(cs kubernetes.Interface, ns string, minAvailable
}, },
} }
_, err := cs.PolicyV1beta1().PodDisruptionBudgets(ns).Create(&pdb) _, err := cs.PolicyV1beta1().PodDisruptionBudgets(ns).Create(&pdb)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
func createPDBMaxUnavailableOrDie(cs kubernetes.Interface, ns string, maxUnavailable intstr.IntOrString) { func createPDBMaxUnavailableOrDie(cs kubernetes.Interface, ns string, maxUnavailable intstr.IntOrString) {
...@@ -244,7 +243,7 @@ func createPDBMaxUnavailableOrDie(cs kubernetes.Interface, ns string, maxUnavail ...@@ -244,7 +243,7 @@ func createPDBMaxUnavailableOrDie(cs kubernetes.Interface, ns string, maxUnavail
}, },
} }
_, err := cs.PolicyV1beta1().PodDisruptionBudgets(ns).Create(&pdb) _, err := cs.PolicyV1beta1().PodDisruptionBudgets(ns).Create(&pdb)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
func createPodsOrDie(cs kubernetes.Interface, ns string, n int) { func createPodsOrDie(cs kubernetes.Interface, ns string, n int) {
...@@ -272,7 +271,7 @@ func createPodsOrDie(cs kubernetes.Interface, ns string, n int) { ...@@ -272,7 +271,7 @@ func createPodsOrDie(cs kubernetes.Interface, ns string, n int) {
} }
func waitForPodsOrDie(cs kubernetes.Interface, ns string, n int) { func waitForPodsOrDie(cs kubernetes.Interface, ns string, n int) {
By("Waiting for all pods to be running") ginkgo.By("Waiting for all pods to be running")
err := wait.PollImmediate(framework.Poll, schedulingTimeout, func() (bool, error) { err := wait.PollImmediate(framework.Poll, schedulingTimeout, func() (bool, error) {
pods, err := cs.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: "foo=bar"}) pods, err := cs.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: "foo=bar"})
if err != nil { if err != nil {
......
...@@ -18,6 +18,7 @@ package apps ...@@ -18,6 +18,7 @@ package apps
import "github.com/onsi/ginkgo" import "github.com/onsi/ginkgo"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool { func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-apps] "+text, body) return ginkgo.Describe("[sig-apps] "+text, body)
} }
...@@ -31,8 +31,8 @@ import ( ...@@ -31,8 +31,8 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
) )
var _ = SIGDescribe("ReplicationController", func() { var _ = SIGDescribe("ReplicationController", func() {
...@@ -48,7 +48,7 @@ var _ = SIGDescribe("ReplicationController", func() { ...@@ -48,7 +48,7 @@ var _ = SIGDescribe("ReplicationController", func() {
TestReplicationControllerServeImageOrFail(f, "basic", framework.ServeHostnameImage) TestReplicationControllerServeImageOrFail(f, "basic", framework.ServeHostnameImage)
}) })
It("should serve a basic image on each replica with a private image", func() { ginkgo.It("should serve a basic image on each replica with a private image", func() {
// requires private images // requires private images
framework.SkipUnlessProviderIs("gce", "gke") framework.SkipUnlessProviderIs("gce", "gke")
privateimage := imageutils.GetConfig(imageutils.ServeHostname) privateimage := imageutils.GetConfig(imageutils.ServeHostname)
...@@ -110,9 +110,9 @@ func newRC(rsName string, replicas int32, rcPodLabels map[string]string, imageNa ...@@ -110,9 +110,9 @@ func newRC(rsName string, replicas int32, rcPodLabels map[string]string, imageNa
} }
} }
// A basic test to check the deployment of an image using // TestReplicationControllerServeImageOrFail is a basic test to check
// a replication controller. The image serves its hostname // the deployment of an image using a replication controller.
// which is checked for each replica. // The image serves its hostname which is checked for each replica.
func TestReplicationControllerServeImageOrFail(f *framework.Framework, test string, image string) { func TestReplicationControllerServeImageOrFail(f *framework.Framework, test string, image string) {
name := "my-hostname-" + test + "-" + string(uuid.NewUUID()) name := "my-hostname-" + test + "-" + string(uuid.NewUUID())
replicas := int32(1) replicas := int32(1)
...@@ -121,16 +121,16 @@ func TestReplicationControllerServeImageOrFail(f *framework.Framework, test stri ...@@ -121,16 +121,16 @@ func TestReplicationControllerServeImageOrFail(f *framework.Framework, test stri
// that serves its hostname. // that serves its hostname.
// The source for the Docker container kubernetes/serve_hostname is // The source for the Docker container kubernetes/serve_hostname is
// in contrib/for-demos/serve_hostname // in contrib/for-demos/serve_hostname
By(fmt.Sprintf("Creating replication controller %s", name)) ginkgo.By(fmt.Sprintf("Creating replication controller %s", name))
newRC := newRC(name, replicas, map[string]string{"name": name}, name, image) newRC := newRC(name, replicas, map[string]string{"name": name}, name, image)
newRC.Spec.Template.Spec.Containers[0].Ports = []v1.ContainerPort{{ContainerPort: 9376}} newRC.Spec.Template.Spec.Containers[0].Ports = []v1.ContainerPort{{ContainerPort: 9376}}
_, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(newRC) _, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(newRC)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
// Check that pods for the new RC were created. // Check that pods for the new RC were created.
// TODO: Maybe switch PodsCreated to just check owner references. // TODO: Maybe switch PodsCreated to just check owner references.
pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, name, replicas) pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, name, replicas)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
// Wait for the pods to enter the running state. Waiting loops until the pods // Wait for the pods to enter the running state. Waiting loops until the pods
// are running so non-running pods cause a timeout for this test. // are running so non-running pods cause a timeout for this test.
...@@ -149,14 +149,14 @@ func TestReplicationControllerServeImageOrFail(f *framework.Framework, test stri ...@@ -149,14 +149,14 @@ func TestReplicationControllerServeImageOrFail(f *framework.Framework, test stri
err = fmt.Errorf("Pod %q never run: %v", pod.Name, err) err = fmt.Errorf("Pod %q never run: %v", pod.Name, err)
} }
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
framework.Logf("Pod %q is running (conditions: %+v)", pod.Name, pod.Status.Conditions) framework.Logf("Pod %q is running (conditions: %+v)", pod.Name, pod.Status.Conditions)
running++ running++
} }
// Sanity check // Sanity check
if running != replicas { if running != replicas {
Expect(fmt.Errorf("unexpected number of running pods: %+v", pods.Items)).NotTo(HaveOccurred()) gomega.Expect(fmt.Errorf("unexpected number of running pods: %+v", pods.Items)).NotTo(gomega.HaveOccurred())
} }
// Verify that something is listening. // Verify that something is listening.
...@@ -182,7 +182,7 @@ func testReplicationControllerConditionCheck(f *framework.Framework) { ...@@ -182,7 +182,7 @@ func testReplicationControllerConditionCheck(f *framework.Framework) {
framework.Logf("Creating quota %q that allows only two pods to run in the current namespace", name) framework.Logf("Creating quota %q that allows only two pods to run in the current namespace", name)
quota := newPodQuota(name, "2") quota := newPodQuota(name, "2")
_, err := c.CoreV1().ResourceQuotas(namespace).Create(quota) _, err := c.CoreV1().ResourceQuotas(namespace).Create(quota)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
quota, err = c.CoreV1().ResourceQuotas(namespace).Get(name, metav1.GetOptions{}) quota, err = c.CoreV1().ResourceQuotas(namespace).Get(name, metav1.GetOptions{})
...@@ -196,14 +196,14 @@ func testReplicationControllerConditionCheck(f *framework.Framework) { ...@@ -196,14 +196,14 @@ func testReplicationControllerConditionCheck(f *framework.Framework) {
if err == wait.ErrWaitTimeout { if err == wait.ErrWaitTimeout {
err = fmt.Errorf("resource quota %q never synced", name) err = fmt.Errorf("resource quota %q never synced", name)
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By(fmt.Sprintf("Creating rc %q that asks for more than the allowed pod quota", name)) ginkgo.By(fmt.Sprintf("Creating rc %q that asks for more than the allowed pod quota", name))
rc := newRC(name, 3, map[string]string{"name": name}, NginxImageName, NginxImage) rc := newRC(name, 3, map[string]string{"name": name}, NginxImageName, NginxImage)
rc, err = c.CoreV1().ReplicationControllers(namespace).Create(rc) rc, err = c.CoreV1().ReplicationControllers(namespace).Create(rc)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By(fmt.Sprintf("Checking rc %q has the desired failure condition set", name)) ginkgo.By(fmt.Sprintf("Checking rc %q has the desired failure condition set", name))
generation := rc.Generation generation := rc.Generation
conditions := rc.Status.Conditions conditions := rc.Status.Conditions
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
...@@ -223,16 +223,16 @@ func testReplicationControllerConditionCheck(f *framework.Framework) { ...@@ -223,16 +223,16 @@ func testReplicationControllerConditionCheck(f *framework.Framework) {
if err == wait.ErrWaitTimeout { if err == wait.ErrWaitTimeout {
err = fmt.Errorf("rc manager never added the failure condition for rc %q: %#v", name, conditions) err = fmt.Errorf("rc manager never added the failure condition for rc %q: %#v", name, conditions)
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By(fmt.Sprintf("Scaling down rc %q to satisfy pod quota", name)) ginkgo.By(fmt.Sprintf("Scaling down rc %q to satisfy pod quota", name))
rc, err = framework.UpdateReplicationControllerWithRetries(c, namespace, name, func(update *v1.ReplicationController) { rc, err = framework.UpdateReplicationControllerWithRetries(c, namespace, name, func(update *v1.ReplicationController) {
x := int32(2) x := int32(2)
update.Spec.Replicas = &x update.Spec.Replicas = &x
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By(fmt.Sprintf("Checking rc %q has no failure condition set", name)) ginkgo.By(fmt.Sprintf("Checking rc %q has no failure condition set", name))
generation = rc.Generation generation = rc.Generation
conditions = rc.Status.Conditions conditions = rc.Status.Conditions
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
...@@ -252,12 +252,12 @@ func testReplicationControllerConditionCheck(f *framework.Framework) { ...@@ -252,12 +252,12 @@ func testReplicationControllerConditionCheck(f *framework.Framework) {
if err == wait.ErrWaitTimeout { if err == wait.ErrWaitTimeout {
err = fmt.Errorf("rc manager never removed the failure condition for rc %q: %#v", name, conditions) err = fmt.Errorf("rc manager never removed the failure condition for rc %q: %#v", name, conditions)
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
func testRCAdoptMatchingOrphans(f *framework.Framework) { func testRCAdoptMatchingOrphans(f *framework.Framework) {
name := "pod-adoption" name := "pod-adoption"
By(fmt.Sprintf("Given a Pod with a 'name' label %s is created", name)) ginkgo.By(fmt.Sprintf("Given a Pod with a 'name' label %s is created", name))
p := f.PodClient().CreateSync(&v1.Pod{ p := f.PodClient().CreateSync(&v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
...@@ -275,21 +275,21 @@ func testRCAdoptMatchingOrphans(f *framework.Framework) { ...@@ -275,21 +275,21 @@ func testRCAdoptMatchingOrphans(f *framework.Framework) {
}, },
}) })
By("When a replication controller with a matching selector is created") ginkgo.By("When a replication controller with a matching selector is created")
replicas := int32(1) replicas := int32(1)
rcSt := newRC(name, replicas, map[string]string{"name": name}, name, NginxImage) rcSt := newRC(name, replicas, map[string]string{"name": name}, name, NginxImage)
rcSt.Spec.Selector = map[string]string{"name": name} rcSt.Spec.Selector = map[string]string{"name": name}
rc, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(rcSt) rc, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(rcSt)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By("Then the orphan pod is adopted") ginkgo.By("Then the orphan pod is adopted")
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
p2, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{}) p2, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{})
// The Pod p should either be adopted or deleted by the RC // The Pod p should either be adopted or deleted by the RC
if errors.IsNotFound(err) { if errors.IsNotFound(err) {
return true, nil return true, nil
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
for _, owner := range p2.OwnerReferences { for _, owner := range p2.OwnerReferences {
if *owner.Controller && owner.UID == rc.UID { if *owner.Controller && owner.UID == rc.UID {
// pod adopted // pod adopted
...@@ -299,26 +299,26 @@ func testRCAdoptMatchingOrphans(f *framework.Framework) { ...@@ -299,26 +299,26 @@ func testRCAdoptMatchingOrphans(f *framework.Framework) {
// pod still not adopted // pod still not adopted
return false, nil return false, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
func testRCReleaseControlledNotMatching(f *framework.Framework) { func testRCReleaseControlledNotMatching(f *framework.Framework) {
name := "pod-release" name := "pod-release"
By("Given a ReplicationController is created") ginkgo.By("Given a ReplicationController is created")
replicas := int32(1) replicas := int32(1)
rcSt := newRC(name, replicas, map[string]string{"name": name}, name, NginxImage) rcSt := newRC(name, replicas, map[string]string{"name": name}, name, NginxImage)
rcSt.Spec.Selector = map[string]string{"name": name} rcSt.Spec.Selector = map[string]string{"name": name}
rc, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(rcSt) rc, err := f.ClientSet.CoreV1().ReplicationControllers(f.Namespace.Name).Create(rcSt)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By("When the matched label of one of its pods change") ginkgo.By("When the matched label of one of its pods change")
pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, rc.Name, replicas) pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, rc.Name, replicas)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
p := pods.Items[0] p := pods.Items[0]
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{}) pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
pod.Labels = map[string]string{"name": "not-matching-name"} pod.Labels = map[string]string{"name": "not-matching-name"}
_, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Update(pod) _, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Update(pod)
...@@ -330,12 +330,12 @@ func testRCReleaseControlledNotMatching(f *framework.Framework) { ...@@ -330,12 +330,12 @@ func testRCReleaseControlledNotMatching(f *framework.Framework) {
} }
return true, nil return true, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By("Then the pod is released") ginkgo.By("Then the pod is released")
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
p2, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{}) p2, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
for _, owner := range p2.OwnerReferences { for _, owner := range p2.OwnerReferences {
if *owner.Controller && owner.UID == rc.UID { if *owner.Controller && owner.UID == rc.UID {
// pod still belonging to the replication controller // pod still belonging to the replication controller
...@@ -345,5 +345,5 @@ func testRCReleaseControlledNotMatching(f *framework.Framework) { ...@@ -345,5 +345,5 @@ func testRCReleaseControlledNotMatching(f *framework.Framework) {
// pod already released // pod already released
return true, nil return true, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
...@@ -32,8 +32,8 @@ import ( ...@@ -32,8 +32,8 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
replicasetutil "k8s.io/kubernetes/test/e2e/framework/replicaset" replicasetutil "k8s.io/kubernetes/test/e2e/framework/replicaset"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
) )
...@@ -92,7 +92,7 @@ var _ = SIGDescribe("ReplicaSet", func() { ...@@ -92,7 +92,7 @@ var _ = SIGDescribe("ReplicaSet", func() {
testReplicaSetServeImageOrFail(f, "basic", framework.ServeHostnameImage) testReplicaSetServeImageOrFail(f, "basic", framework.ServeHostnameImage)
}) })
It("should serve a basic image on each replica with a private image", func() { ginkgo.It("should serve a basic image on each replica with a private image", func() {
// requires private images // requires private images
framework.SkipUnlessProviderIs("gce", "gke") framework.SkipUnlessProviderIs("gce", "gke")
privateimage := imageutils.GetConfig(imageutils.ServeHostname) privateimage := imageutils.GetConfig(imageutils.ServeHostname)
...@@ -100,7 +100,7 @@ var _ = SIGDescribe("ReplicaSet", func() { ...@@ -100,7 +100,7 @@ var _ = SIGDescribe("ReplicaSet", func() {
testReplicaSetServeImageOrFail(f, "private", privateimage.GetE2EImage()) testReplicaSetServeImageOrFail(f, "private", privateimage.GetE2EImage())
}) })
It("should surface a failure condition on a common issue like exceeded quota", func() { ginkgo.It("should surface a failure condition on a common issue like exceeded quota", func() {
testReplicaSetConditionCheck(f) testReplicaSetConditionCheck(f)
}) })
...@@ -127,12 +127,12 @@ func testReplicaSetServeImageOrFail(f *framework.Framework, test string, image s ...@@ -127,12 +127,12 @@ func testReplicaSetServeImageOrFail(f *framework.Framework, test string, image s
newRS := newRS(name, replicas, map[string]string{"name": name}, name, image) newRS := newRS(name, replicas, map[string]string{"name": name}, name, image)
newRS.Spec.Template.Spec.Containers[0].Ports = []v1.ContainerPort{{ContainerPort: 9376}} newRS.Spec.Template.Spec.Containers[0].Ports = []v1.ContainerPort{{ContainerPort: 9376}}
_, err := f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).Create(newRS) _, err := f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).Create(newRS)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
// Check that pods for the new RS were created. // Check that pods for the new RS were created.
// TODO: Maybe switch PodsCreated to just check owner references. // TODO: Maybe switch PodsCreated to just check owner references.
pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, name, replicas) pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, name, replicas)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
// Wait for the pods to enter the running state. Waiting loops until the pods // Wait for the pods to enter the running state. Waiting loops until the pods
// are running so non-running pods cause a timeout for this test. // are running so non-running pods cause a timeout for this test.
...@@ -151,14 +151,14 @@ func testReplicaSetServeImageOrFail(f *framework.Framework, test string, image s ...@@ -151,14 +151,14 @@ func testReplicaSetServeImageOrFail(f *framework.Framework, test string, image s
err = fmt.Errorf("Pod %q never run: %v", pod.Name, err) err = fmt.Errorf("Pod %q never run: %v", pod.Name, err)
} }
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
framework.Logf("Pod %q is running (conditions: %+v)", pod.Name, pod.Status.Conditions) framework.Logf("Pod %q is running (conditions: %+v)", pod.Name, pod.Status.Conditions)
running++ running++
} }
// Sanity check // Sanity check
if running != replicas { if running != replicas {
Expect(fmt.Errorf("unexpected number of running pods: %+v", pods.Items)).NotTo(HaveOccurred()) gomega.Expect(fmt.Errorf("unexpected number of running pods: %+v", pods.Items)).NotTo(gomega.HaveOccurred())
} }
// Verify that something is listening. // Verify that something is listening.
...@@ -181,10 +181,10 @@ func testReplicaSetConditionCheck(f *framework.Framework) { ...@@ -181,10 +181,10 @@ func testReplicaSetConditionCheck(f *framework.Framework) {
namespace := f.Namespace.Name namespace := f.Namespace.Name
name := "condition-test" name := "condition-test"
By(fmt.Sprintf("Creating quota %q that allows only two pods to run in the current namespace", name)) ginkgo.By(fmt.Sprintf("Creating quota %q that allows only two pods to run in the current namespace", name))
quota := newPodQuota(name, "2") quota := newPodQuota(name, "2")
_, err := c.CoreV1().ResourceQuotas(namespace).Create(quota) _, err := c.CoreV1().ResourceQuotas(namespace).Create(quota)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
quota, err = c.CoreV1().ResourceQuotas(namespace).Get(name, metav1.GetOptions{}) quota, err = c.CoreV1().ResourceQuotas(namespace).Get(name, metav1.GetOptions{})
...@@ -198,14 +198,14 @@ func testReplicaSetConditionCheck(f *framework.Framework) { ...@@ -198,14 +198,14 @@ func testReplicaSetConditionCheck(f *framework.Framework) {
if err == wait.ErrWaitTimeout { if err == wait.ErrWaitTimeout {
err = fmt.Errorf("resource quota %q never synced", name) err = fmt.Errorf("resource quota %q never synced", name)
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By(fmt.Sprintf("Creating replica set %q that asks for more than the allowed pod quota", name)) ginkgo.By(fmt.Sprintf("Creating replica set %q that asks for more than the allowed pod quota", name))
rs := newRS(name, 3, map[string]string{"name": name}, NginxImageName, NginxImage) rs := newRS(name, 3, map[string]string{"name": name}, NginxImageName, NginxImage)
rs, err = c.AppsV1().ReplicaSets(namespace).Create(rs) rs, err = c.AppsV1().ReplicaSets(namespace).Create(rs)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By(fmt.Sprintf("Checking replica set %q has the desired failure condition set", name)) ginkgo.By(fmt.Sprintf("Checking replica set %q has the desired failure condition set", name))
generation := rs.Generation generation := rs.Generation
conditions := rs.Status.Conditions conditions := rs.Status.Conditions
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
...@@ -226,16 +226,16 @@ func testReplicaSetConditionCheck(f *framework.Framework) { ...@@ -226,16 +226,16 @@ func testReplicaSetConditionCheck(f *framework.Framework) {
if err == wait.ErrWaitTimeout { if err == wait.ErrWaitTimeout {
err = fmt.Errorf("rs controller never added the failure condition for replica set %q: %#v", name, conditions) err = fmt.Errorf("rs controller never added the failure condition for replica set %q: %#v", name, conditions)
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By(fmt.Sprintf("Scaling down replica set %q to satisfy pod quota", name)) ginkgo.By(fmt.Sprintf("Scaling down replica set %q to satisfy pod quota", name))
rs, err = replicasetutil.UpdateReplicaSetWithRetries(c, namespace, name, func(update *apps.ReplicaSet) { rs, err = replicasetutil.UpdateReplicaSetWithRetries(c, namespace, name, func(update *apps.ReplicaSet) {
x := int32(2) x := int32(2)
update.Spec.Replicas = &x update.Spec.Replicas = &x
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By(fmt.Sprintf("Checking replica set %q has no failure condition set", name)) ginkgo.By(fmt.Sprintf("Checking replica set %q has no failure condition set", name))
generation = rs.Generation generation = rs.Generation
conditions = rs.Status.Conditions conditions = rs.Status.Conditions
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
...@@ -255,12 +255,12 @@ func testReplicaSetConditionCheck(f *framework.Framework) { ...@@ -255,12 +255,12 @@ func testReplicaSetConditionCheck(f *framework.Framework) {
if err == wait.ErrWaitTimeout { if err == wait.ErrWaitTimeout {
err = fmt.Errorf("rs controller never removed the failure condition for rs %q: %#v", name, conditions) err = fmt.Errorf("rs controller never removed the failure condition for rs %q: %#v", name, conditions)
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) { func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) {
name := "pod-adoption-release" name := "pod-adoption-release"
By(fmt.Sprintf("Given a Pod with a 'name' label %s is created", name)) ginkgo.By(fmt.Sprintf("Given a Pod with a 'name' label %s is created", name))
p := f.PodClient().CreateSync(&v1.Pod{ p := f.PodClient().CreateSync(&v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
...@@ -278,21 +278,21 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) { ...@@ -278,21 +278,21 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) {
}, },
}) })
By("When a replicaset with a matching selector is created") ginkgo.By("When a replicaset with a matching selector is created")
replicas := int32(1) replicas := int32(1)
rsSt := newRS(name, replicas, map[string]string{"name": name}, name, NginxImage) rsSt := newRS(name, replicas, map[string]string{"name": name}, name, NginxImage)
rsSt.Spec.Selector = &metav1.LabelSelector{MatchLabels: map[string]string{"name": name}} rsSt.Spec.Selector = &metav1.LabelSelector{MatchLabels: map[string]string{"name": name}}
rs, err := f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).Create(rsSt) rs, err := f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).Create(rsSt)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By("Then the orphan pod is adopted") ginkgo.By("Then the orphan pod is adopted")
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
p2, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{}) p2, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{})
// The Pod p should either be adopted or deleted by the ReplicaSet // The Pod p should either be adopted or deleted by the ReplicaSet
if errors.IsNotFound(err) { if errors.IsNotFound(err) {
return true, nil return true, nil
} }
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
for _, owner := range p2.OwnerReferences { for _, owner := range p2.OwnerReferences {
if *owner.Controller && owner.UID == rs.UID { if *owner.Controller && owner.UID == rs.UID {
// pod adopted // pod adopted
...@@ -302,16 +302,16 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) { ...@@ -302,16 +302,16 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) {
// pod still not adopted // pod still not adopted
return false, nil return false, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By("When the matched label of one of its pods change") ginkgo.By("When the matched label of one of its pods change")
pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, rs.Name, replicas) pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, rs.Name, replicas)
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
p = &pods.Items[0] p = &pods.Items[0]
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{}) pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
pod.Labels = map[string]string{"name": "not-matching-name"} pod.Labels = map[string]string{"name": "not-matching-name"}
_, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Update(pod) _, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Update(pod)
...@@ -323,12 +323,12 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) { ...@@ -323,12 +323,12 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) {
} }
return true, nil return true, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
By("Then the pod is released") ginkgo.By("Then the pod is released")
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
p2, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{}) p2, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(p.Name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
for _, owner := range p2.OwnerReferences { for _, owner := range p2.OwnerReferences {
if *owner.Controller && owner.UID == rs.UID { if *owner.Controller && owner.UID == rs.UID {
// pod still belonging to the replicaset // pod still belonging to the replicaset
...@@ -338,5 +338,5 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) { ...@@ -338,5 +338,5 @@ func testRSAdoptMatchingAndReleaseNotMatching(f *framework.Framework) {
// pod already released // pod already released
return true, nil return true, nil
}) })
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
} }
...@@ -28,11 +28,24 @@ const ( ...@@ -28,11 +28,24 @@ const (
) )
var ( var (
// CronJobGroupVersionResourceAlpha unambiguously identifies a resource of cronjob with alpha status
CronJobGroupVersionResourceAlpha = schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"} CronJobGroupVersionResourceAlpha = schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}
CronJobGroupVersionResourceBeta = schema.GroupVersionResource{Group: "batch", Version: "v1beta1", Resource: "cronjobs"}
NautilusImage = imageutils.GetE2EImage(imageutils.Nautilus) // CronJobGroupVersionResourceBeta unambiguously identifies a resource of cronjob with beta status
KittenImage = imageutils.GetE2EImage(imageutils.Kitten) CronJobGroupVersionResourceBeta = schema.GroupVersionResource{Group: "batch", Version: "v1beta1", Resource: "cronjobs"}
NginxImage = imageutils.GetE2EImage(imageutils.Nginx)
NewNginxImage = imageutils.GetE2EImage(imageutils.NginxNew) // NautilusImage is the fully qualified URI to the Nautilus image
RedisImage = imageutils.GetE2EImage(imageutils.Redis) NautilusImage = imageutils.GetE2EImage(imageutils.Nautilus)
// KittenImage is the fully qualified URI to the Kitten image
KittenImage = imageutils.GetE2EImage(imageutils.Kitten)
// NginxImage is the fully qualified URI to the Nginx image
NginxImage = imageutils.GetE2EImage(imageutils.Nginx)
// NewNginxImage is the fully qualified URI to the NginxNew image
NewNginxImage = imageutils.GetE2EImage(imageutils.NginxNew)
// RedisImage is the fully qualified URI to the Redis image
RedisImage = imageutils.GetE2EImage(imageutils.Redis)
) )
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