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
Charles-Edouard Brétéché e1db7c9814
feat: add e2e framework and verify image new test (#4094)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-06-09 21:58:07 +08:00

23 lines
663 B
Go

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)
}
}
}