MCPcopy Create free account
hub / github.com/VictoriaMetrics/operator / assertAnnotationsOnObjects

Function assertAnnotationsOnObjects

test/e2e/utils_test.go:196–213  ·  view source on GitHub ↗

nolint:dupl,lll

(ctx context.Context, nss types.NamespacedName, objects []client.Object, annotations map[string]string)

Source from the content-addressed store, hash-verified

194
195//nolint:dupl,lll
196func assertAnnotationsOnObjects(ctx context.Context, nss types.NamespacedName, objects []client.Object, annotations map[string]string) {
197 GinkgoHelper()
198 for idx, obj := range objects {
199 Expect(k8sClient.Get(ctx, nss, obj)).ToNot(HaveOccurred())
200 gotAnnotations := obj.GetAnnotations()
201 for k, v := range annotations {
202 gv, ok := gotAnnotations[k]
203 if v == "" {
204 Expect(ok).To(BeFalse(), "annotation key=%q,value=%q must not exist for %T at idx=%d, object=%q", k, gv, obj, idx, nss.String())
205 } else {
206 Expect(ok).To(BeTrue(), "annotation key=%s must present for %T at idx=%d, object=%q", k, obj, idx, nss.String())
207 Expect(gv).To(Equal(v), "annotation key=%s must equal for %T at idx=%d, object=%q", k, obj, idx, nss.String())
208
209 }
210
211 }
212 }
213}
214
215//nolint:dupl,lll
216func assertLabelsOnObjects(ctx context.Context, nss types.NamespacedName, objects []client.Object, wantLabels map[string]string) {

Callers 6

vlsingle_test.goFile · 0.85
vmsingle_test.goFile · 0.85
vmcluster_test.goFile · 0.85
vtsingle_test.goFile · 0.85
vlcluster_test.goFile · 0.85
vtcluster_test.goFile · 0.85

Calls 2

GetMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected