mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-01 14:22:17 +00:00
Merge pull request #74314 from oomichi/add-ExpectError
Add ExpectError() to e2e test framework
This commit is contained in:
@@ -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...)
|
||||
|
||||
Reference in New Issue
Block a user