diff --git a/modules/test/utils.go b/modules/test/utils.go index 7809882f5e..9a64a0476d 100644 --- a/modules/test/utils.go +++ b/modules/test/utils.go @@ -22,3 +22,11 @@ func MockVariableValue[T any](p *T, v T) (reset func()) { *p = v return func() { *p = old } } + +func MockVariable[T any](variable *T, mock T) func() { + original := *variable + *variable = mock + return func() { + *variable = original + } +}