mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
e2e framework: add AnnotatedLocationWithOffset
This is useful in helper functions which themselves don't need to be recorded.
This commit is contained in:
parent
c466c49682
commit
896c6fa082
@ -52,7 +52,13 @@ func IgnoreNotFound(in any) any {
|
|||||||
// locations by passing the result as additional parameter to a
|
// locations by passing the result as additional parameter to a
|
||||||
// BeforeEach/AfterEach/DeferCleanup/It/etc.
|
// BeforeEach/AfterEach/DeferCleanup/It/etc.
|
||||||
func AnnotatedLocation(annotation string) types.CodeLocation {
|
func AnnotatedLocation(annotation string) types.CodeLocation {
|
||||||
codeLocation := types.NewCodeLocation(1)
|
return AnnotatedLocationWithOffset(annotation, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnnotatedLocationWithOffset skips additional call stack levels. With 0 as offset
|
||||||
|
// it is identical to [AnnotatedLocation].
|
||||||
|
func AnnotatedLocationWithOffset(annotation string, offset int) types.CodeLocation {
|
||||||
|
codeLocation := types.NewCodeLocation(offset + 1)
|
||||||
codeLocation.FileName = path.Base(codeLocation.FileName)
|
codeLocation.FileName = path.Base(codeLocation.FileName)
|
||||||
codeLocation = types.NewCustomCodeLocation(annotation + " | " + codeLocation.String())
|
codeLocation = types.NewCustomCodeLocation(annotation + " | " + codeLocation.String())
|
||||||
return codeLocation
|
return codeLocation
|
||||||
|
Loading…
Reference in New Issue
Block a user