mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +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
|
||||
// BeforeEach/AfterEach/DeferCleanup/It/etc.
|
||||
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 = types.NewCustomCodeLocation(annotation + " | " + codeLocation.String())
|
||||
return codeLocation
|
||||
|
Loading…
Reference in New Issue
Block a user