MCPcopy
hub / github.com/apecloud/kubeblocks / TestBuildImagePullSecretsByEnv

Function TestBuildImagePullSecretsByEnv

pkg/controllerutil/pod_utils_test.go:669–701  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

667})
668
669func TestBuildImagePullSecretsByEnv(t *testing.T) {
670 tests := []struct {
671 value string
672 expected []corev1.LocalObjectReference
673 }{
674 {
675 value: "",
676 expected: nil,
677 },
678 {
679 value: "[{\"name\":\"test\"}]",
680 expected: []corev1.LocalObjectReference{
681 {
682 Name: "test",
683 },
684 },
685 },
686 }
687
688 Context("test BuildImagePullSecrets", func() {
689 It("Should succeed with no error", func() {
690 for _, t := range tests {
691 viper.Set(constant.KBImagePullSecrets, t.value)
692 secrets := BuildImagePullSecrets()
693 if t.value == "" {
694 Expect(len(secrets)).To(Equal(0))
695 } else {
696 Expect(secrets).To(Equal(t.expected))
697 }
698 }
699 })
700 })
701}

Callers

nothing calls this directly

Calls 3

BuildImagePullSecretsFunction · 0.85
SetMethod · 0.80
ToMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…