mirror of
https://github.com/grafana/grafana.git
synced 2025-09-28 15:43:54 +08:00

* SecretsManager: utils for usage insights on ST mode Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com> * SecretsManager: add assert Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com> * SecretsManager: Remove encryption scope option Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com> * SecretsManager: add fake keeper Co-authored-by: Dana Axinte <53751979+dana-axinte@users.noreply.github.com> Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com> Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com> --------- Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com> Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>
27 lines
465 B
Go
27 lines
465 B
Go
package assert
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
)
|
|
|
|
func True(expr bool, msg string, args ...any) {
|
|
if !expr {
|
|
if len(args) > 0 {
|
|
panic(fmt.Sprintf(msg, args...))
|
|
} else {
|
|
panic(msg)
|
|
}
|
|
}
|
|
}
|
|
|
|
func ErrorIs(err1, err2 error) {
|
|
if !errors.Is(err1, err2) {
|
|
panic(fmt.Sprintf("expected error %T(%+v) to be %T(%+v)", err1, err1, err2, err2))
|
|
}
|
|
}
|
|
|
|
func Equal[T comparable](v1 T, v2 T, msg string) {
|
|
True(v1 == v2, "expected %+v to equal %+v: %s", v1, v2, msg)
|
|
}
|