Skip to content

Commit f187480

Browse files
authored
Merge pull request kubernetes#127558 from pohly/e2e-framework-docs
e2e framework: better documentation of ExpectNoError
2 parents c9d6fd9 + e5aa609 commit f187480

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/e2e/framework/expect.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,22 @@ func (f *FailureError) backtrace() {
294294
var ErrFailure error = FailureError{}
295295

296296
// ExpectNoError checks if "err" is set, and if so, fails assertion while logging the error.
297+
//
298+
// As in [gomega.Expect], the explain parameters can be used to provide
299+
// additional information in case of a failure in one of these two ways:
300+
// - A single string is used as first line of the failure message directly.
301+
// - A string with additional parameters is passed through [fmt.Sprintf].
297302
func ExpectNoError(err error, explain ...interface{}) {
298303
ExpectNoErrorWithOffset(1, err, explain...)
299304
}
300305

301306
// ExpectNoErrorWithOffset checks if "err" is set, and if so, fails assertion while logging the error at "offset" levels above its caller
302307
// (for example, for call chain f -> g -> ExpectNoErrorWithOffset(1, ...) error would be logged for "f").
308+
//
309+
// As in [gomega.Expect], the explain parameters can be used to provide
310+
// additional information in case of a failure in one of these two ways:
311+
// - A single string is used as first line of the failure message directly.
312+
// - A string with additional parameters is passed through [fmt.Sprintf].
303313
func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{}) {
304314
if err == nil {
305315
return

0 commit comments

Comments
 (0)