package kmp import ( "fmt" "gotest.tools/v3/assert/cmp" "sigs.k8s.io/controller-runtime/pkg/client" "edge-infra.dev/pkg/k8s/object" ) // HasAnnotation checks that the compared object has an annotation with the // expected key and value. func HasAnnotation(key, value string) Komparison { return func(o client.Object) cmp.Result { if o.GetAnnotations()[key] == value { return cmp.ResultSuccess } return cmp.ResultFailure(fmt.Sprintf( "%s doesn't contain expected annotation '%s:%s'", object.FmtObject(o), key, value), ) } }