1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-10 18:06:55 +00:00
kyverno/test/e2e/framework/step/expect.go

24 lines
663 B
Go
Raw Normal View History

package step
import (
"fmt"
"github.com/kyverno/kyverno/test/e2e/framework/client"
"github.com/kyverno/kyverno/test/e2e/framework/id"
"github.com/kyverno/kyverno/test/e2e/framework/utils"
"github.com/onsi/ginkgo"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
type ResourceExpectation func(*unstructured.Unstructured)
func ExpectResource(id id.Id, expectations ...ResourceExpectation) Step {
return func(client client.Client) {
ginkgo.By(fmt.Sprintf("Checking resource expectations (%s : %s) ...", id.GetGvr(), utils.Key(id)))
resource := client.GetResource(id)
for _, expectation := range expectations {
expectation(resource)
}
}
}