Merge pull request #74314 from oomichi/add-ExpectError

Add ExpectError() to e2e test framework
This commit is contained in:
Kubernetes Prow Robot
2019-05-09 15:47:57 -07:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -2039,6 +2039,11 @@ func RandomSuffix() string {
return strconv.Itoa(r.Int() % 10000)
}
// ExpectError expects an error happens, otherwise an exception raises
func ExpectError(err error, explain ...interface{}) {
gomega.Expect(err).To(gomega.HaveOccurred(), explain...)
}
// ExpectNoError checks if "err" is set, and if so, fails assertion while logging the error.
func ExpectNoError(err error, explain ...interface{}) {
ExpectNoErrorWithOffset(1, err, explain...)