MCPcopy
hub / github.com/helm/helm / TestUncompressedConfigMapGet

Function TestUncompressedConfigMapGet

pkg/storage/driver/cfgmaps_test.go:57–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func TestUncompressedConfigMapGet(t *testing.T) {
58 vers := 1
59 name := "smug-pigeon"
60 namespace := "default"
61 key := testKey(name, vers)
62 rel := releaseStub(name, vers, namespace, common.StatusDeployed)
63
64 // Create a test fixture which contains an uncompressed release
65 cfgmap, err := newConfigMapsObject(key, rel, nil)
66 if err != nil {
67 t.Fatalf("Failed to create configmap: %s", err)
68 }
69 b, err := json.Marshal(rel)
70 if err != nil {
71 t.Fatalf("Failed to marshal release: %s", err)
72 }
73 cfgmap.Data["release"] = base64.StdEncoding.EncodeToString(b)
74 var mock MockConfigMapsInterface
75 mock.objects = map[string]*v1.ConfigMap{key: cfgmap}
76 cfgmaps := NewConfigMaps(&mock)
77
78 // get release with key
79 got, err := cfgmaps.Get(key)
80 if err != nil {
81 t.Fatalf("Failed to get release: %s", err)
82 }
83 // compare fetched release with original
84 if !reflect.DeepEqual(rel, got) {
85 t.Errorf("Expected {%v}, got {%v}", rel, got)
86 }
87}
88
89func convertReleaserToV1(t *testing.T, rel release.Releaser) *rspb.Release {
90 t.Helper()

Callers

nothing calls this directly

Calls 6

GetMethod · 0.95
newConfigMapsObjectFunction · 0.85
NewConfigMapsFunction · 0.85
FatalfMethod · 0.80
testKeyFunction · 0.70
releaseStubFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…