ktesting: add missing methods to error context

Expect and ExpectNoError were not implemented and thus unintentionally
inherited from the base TContext.
This commit is contained in:
Patrick Ohly 2024-02-22 11:43:54 +01:00
parent dc6abc3ff8
commit 4ffa628ead

View File

@ -22,6 +22,7 @@ import (
"strings"
"sync"
"github.com/onsi/gomega"
"k8s.io/klog/v2"
)
@ -138,6 +139,16 @@ func (eCtx *errorContext) CleanupCtx(cb func(TContext)) {
cleanupCtx(eCtx, cb)
}
func (eCtx *errorContext) Expect(actual interface{}, extra ...interface{}) gomega.Assertion {
eCtx.Helper()
return expect(eCtx, actual, extra...)
}
func (eCtx *errorContext) ExpectNoError(err error, explain ...interface{}) {
eCtx.Helper()
expectNoError(eCtx, err, explain...)
}
func (eCtx *errorContext) Logger() klog.Logger {
return klog.FromContext(eCtx)
}