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

Function assertLabelsOnObjects

test/e2e/utils_test.go:253–270  ·  view source on GitHub ↗

nolint:dupl,lll

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

Source from the content-addressed store, hash-verified

251
252//nolint:dupl,lll
253func assertLabelsOnObjects(ctx context.Context, nss types.NamespacedName, objects []client.Object, wantLabels map[string]string) {
254 GinkgoHelper()
255 for idx, obj := range objects {
256 Expect(k8sClient.Get(ctx, nss, obj)).ToNot(HaveOccurred())
257 gotLabels := obj.GetLabels()
258 for k, v := range wantLabels {
259 gv, ok := gotLabels[k]
260 if v == "" {
261 Expect(ok).NotTo(BeTrue(), "label key=%s must not exist for %T at idx=%d", k, obj, idx)
262 } else {
263 Expect(ok).To(BeTrue(), "label key=%s must present for %T at idx=%d", k, obj, idx)
264 Expect(gv).To(Equal(v), "label key=%s must equal for %T at idx=%d", k, obj, idx)
265
266 }
267
268 }
269 }
270}
271
272//nolint:dupl,lll,unparam
273func hasVolume(volumes []corev1.Volume, volumeName string) error {

Callers 1

vmcluster_test.goFile · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected