MCPcopy Index your code
hub / github.com/helm/helm / TestRenderWithClientProvider

Function TestRenderWithClientProvider

pkg/engine/engine_test.go:294–394  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

292}
293
294func TestRenderWithClientProvider(t *testing.T) {
295 provider := &testClientProvider{
296 t: t,
297 scheme: map[string]kindProps{
298 "v1/Namespace": {
299 gvr: schema.GroupVersionResource{
300 Version: "v1",
301 Resource: "namespaces",
302 },
303 },
304 "v1/Pod": {
305 gvr: schema.GroupVersionResource{
306 Version: "v1",
307 Resource: "pods",
308 },
309 namespaced: true,
310 },
311 },
312 objects: []runtime.Object{
313 makeUnstructured("v1", "Namespace", "default", ""),
314 makeUnstructured("v1", "Pod", "pod1", "default"),
315 makeUnstructured("v1", "Pod", "pod2", "ns1"),
316 makeUnstructured("v1", "Pod", "pod3", "ns1"),
317 },
318 }
319
320 type testCase struct {
321 template string
322 output string
323 }
324 cases := map[string]testCase{
325 "ns-single": {
326 template: `{{ (lookup "v1" "Namespace" "" "default").metadata.name }}`,
327 output: "default",
328 },
329 "ns-list": {
330 template: `{{ (lookup "v1" "Namespace" "" "").items | len }}`,
331 output: "1",
332 },
333 "ns-missing": {
334 template: `{{ (lookup "v1" "Namespace" "" "absent") }}`,
335 output: "map[]",
336 },
337 "pod-single": {
338 template: `{{ (lookup "v1" "Pod" "default" "pod1").metadata.name }}`,
339 output: "pod1",
340 },
341 "pod-list": {
342 template: `{{ (lookup "v1" "Pod" "ns1" "").items | len }}`,
343 output: "2",
344 },
345 "pod-all": {
346 template: `{{ (lookup "v1" "Pod" "" "").items | len }}`,
347 output: "3",
348 },
349 "pod-missing": {
350 template: `{{ (lookup "v1" "Pod" "" "ns2") }}`,
351 output: "map[]",

Callers

nothing calls this directly

Calls 6

CoalesceValuesFunction · 0.92
makeUnstructuredFunction · 0.85
RenderWithClientProviderFunction · 0.85
NowMethod · 0.80
FatalfMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…