Use ExpectNoError() for e2e/upgrades
The e2e test framework has ExpectNoError() for readable test code. This replaces Expect(err).NotTo(HaveOccurred()) with it.
This commit is contained in:
		@@ -100,8 +100,10 @@ func (t *CassandraUpgradeTest) Setup(f *framework.Framework) {
 | 
				
			|||||||
	e2elog.Logf("Service endpoint is up")
 | 
						e2elog.Logf("Service endpoint is up")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Adding 2 dummy users")
 | 
						ginkgo.By("Adding 2 dummy users")
 | 
				
			||||||
	gomega.Expect(t.addUser("Alice")).NotTo(gomega.HaveOccurred())
 | 
						err = t.addUser("Alice")
 | 
				
			||||||
	gomega.Expect(t.addUser("Bob")).NotTo(gomega.HaveOccurred())
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
 | 
						err = t.addUser("Bob")
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
	t.successfulWrites = 2
 | 
						t.successfulWrites = 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Verifying that the users exist")
 | 
						ginkgo.By("Verifying that the users exist")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,8 +95,10 @@ func (t *EtcdUpgradeTest) Setup(f *framework.Framework) {
 | 
				
			|||||||
	e2elog.Logf("Service endpoint is up")
 | 
						e2elog.Logf("Service endpoint is up")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Adding 2 dummy users")
 | 
						ginkgo.By("Adding 2 dummy users")
 | 
				
			||||||
	gomega.Expect(t.addUser("Alice")).NotTo(gomega.HaveOccurred())
 | 
						err = t.addUser("Alice")
 | 
				
			||||||
	gomega.Expect(t.addUser("Bob")).NotTo(gomega.HaveOccurred())
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
 | 
						err = t.addUser("Bob")
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
	t.successfulWrites = 2
 | 
						t.successfulWrites = 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Verifying that the users exist")
 | 
						ginkgo.By("Verifying that the users exist")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,7 +30,6 @@ import (
 | 
				
			|||||||
	e2elog "k8s.io/kubernetes/test/e2e/framework/log"
 | 
						e2elog "k8s.io/kubernetes/test/e2e/framework/log"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/onsi/ginkgo"
 | 
						"github.com/onsi/ginkgo"
 | 
				
			||||||
	"github.com/onsi/gomega"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
@@ -50,7 +49,8 @@ func (KubeProxyUpgradeTest) Name() string { return "[sig-network] kube-proxy-upg
 | 
				
			|||||||
// Setup verifies kube-proxy static pods is running before upgrade.
 | 
					// Setup verifies kube-proxy static pods is running before upgrade.
 | 
				
			||||||
func (t *KubeProxyUpgradeTest) Setup(f *framework.Framework) {
 | 
					func (t *KubeProxyUpgradeTest) Setup(f *framework.Framework) {
 | 
				
			||||||
	ginkgo.By("Waiting for kube-proxy static pods running and ready")
 | 
						ginkgo.By("Waiting for kube-proxy static pods running and ready")
 | 
				
			||||||
	gomega.Expect(waitForKubeProxyStaticPodsRunning(f.ClientSet)).NotTo(gomega.HaveOccurred())
 | 
						err := waitForKubeProxyStaticPodsRunning(f.ClientSet)
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Test validates if kube-proxy is migrated from static pods to DaemonSet.
 | 
					// Test validates if kube-proxy is migrated from static pods to DaemonSet.
 | 
				
			||||||
@@ -62,10 +62,12 @@ func (t *KubeProxyUpgradeTest) Test(f *framework.Framework, done <-chan struct{}
 | 
				
			|||||||
	<-done
 | 
						<-done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Waiting for kube-proxy static pods disappear")
 | 
						ginkgo.By("Waiting for kube-proxy static pods disappear")
 | 
				
			||||||
	gomega.Expect(waitForKubeProxyStaticPodsDisappear(c)).NotTo(gomega.HaveOccurred())
 | 
						err := waitForKubeProxyStaticPodsDisappear(c)
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Waiting for kube-proxy DaemonSet running and ready")
 | 
						ginkgo.By("Waiting for kube-proxy DaemonSet running and ready")
 | 
				
			||||||
	gomega.Expect(waitForKubeProxyDaemonSetRunning(c)).NotTo(gomega.HaveOccurred())
 | 
						err = waitForKubeProxyDaemonSetRunning(c)
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Teardown does nothing.
 | 
					// Teardown does nothing.
 | 
				
			||||||
@@ -82,7 +84,8 @@ func (KubeProxyDowngradeTest) Name() string { return "[sig-network] kube-proxy-d
 | 
				
			|||||||
// Setup verifies kube-proxy DaemonSet is running before upgrade.
 | 
					// Setup verifies kube-proxy DaemonSet is running before upgrade.
 | 
				
			||||||
func (t *KubeProxyDowngradeTest) Setup(f *framework.Framework) {
 | 
					func (t *KubeProxyDowngradeTest) Setup(f *framework.Framework) {
 | 
				
			||||||
	ginkgo.By("Waiting for kube-proxy DaemonSet running and ready")
 | 
						ginkgo.By("Waiting for kube-proxy DaemonSet running and ready")
 | 
				
			||||||
	gomega.Expect(waitForKubeProxyDaemonSetRunning(f.ClientSet)).NotTo(gomega.HaveOccurred())
 | 
						err := waitForKubeProxyDaemonSetRunning(f.ClientSet)
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Test validates if kube-proxy is migrated from DaemonSet to static pods.
 | 
					// Test validates if kube-proxy is migrated from DaemonSet to static pods.
 | 
				
			||||||
@@ -94,10 +97,12 @@ func (t *KubeProxyDowngradeTest) Test(f *framework.Framework, done <-chan struct
 | 
				
			|||||||
	<-done
 | 
						<-done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Waiting for kube-proxy DaemonSet disappear")
 | 
						ginkgo.By("Waiting for kube-proxy DaemonSet disappear")
 | 
				
			||||||
	gomega.Expect(waitForKubeProxyDaemonSetDisappear(c)).NotTo(gomega.HaveOccurred())
 | 
						err := waitForKubeProxyDaemonSetDisappear(c)
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Waiting for kube-proxy static pods running and ready")
 | 
						ginkgo.By("Waiting for kube-proxy static pods running and ready")
 | 
				
			||||||
	gomega.Expect(waitForKubeProxyStaticPodsRunning(c)).NotTo(gomega.HaveOccurred())
 | 
						err = waitForKubeProxyStaticPodsRunning(c)
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Teardown does nothing.
 | 
					// Teardown does nothing.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -110,8 +110,10 @@ func (t *MySQLUpgradeTest) Setup(f *framework.Framework) {
 | 
				
			|||||||
	e2elog.Logf("Service endpoint is up")
 | 
						e2elog.Logf("Service endpoint is up")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Adding 2 names to the database")
 | 
						ginkgo.By("Adding 2 names to the database")
 | 
				
			||||||
	gomega.Expect(t.addName(strconv.Itoa(t.nextWrite))).NotTo(gomega.HaveOccurred())
 | 
						err = t.addName(strconv.Itoa(t.nextWrite))
 | 
				
			||||||
	gomega.Expect(t.addName(strconv.Itoa(t.nextWrite))).NotTo(gomega.HaveOccurred())
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
 | 
						err = t.addName(strconv.Itoa(t.nextWrite))
 | 
				
			||||||
 | 
						framework.ExpectNoError(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ginkgo.By("Verifying that the 2 names have been inserted")
 | 
						ginkgo.By("Verifying that the 2 names have been inserted")
 | 
				
			||||||
	count, err := t.countNames()
 | 
						count, err := t.countNames()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user