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

Function assertLabelsOnObjects

test/e2e/utils_test.go:216–233  ·  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

214
215//nolint:dupl,lll
216func assertLabelsOnObjects(ctx context.Context, nss types.NamespacedName, objects []client.Object, wantLabels map[string]string) {
217 GinkgoHelper()
218 for idx, obj := range objects {
219 Expect(k8sClient.Get(ctx, nss, obj)).ToNot(HaveOccurred())
220 gotLabels := obj.GetLabels()
221 for k, v := range wantLabels {
222 gv, ok := gotLabels[k]
223 if v == "" {
224 Expect(ok).NotTo(BeTrue(), "label key=%s must not exist for %T at idx=%d", k, obj, idx)
225 } else {
226 Expect(ok).To(BeTrue(), "label key=%s must present for %T at idx=%d", k, obj, idx)
227 Expect(gv).To(Equal(v), "label key=%s must equal for %T at idx=%d", k, obj, idx)
228
229 }
230
231 }
232 }
233}
234
235//nolint:dupl,lll,unparam
236func 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