MCPcopy
hub / github.com/argoproj/argo-workflows / TestWithTemplateBase

Function TestWithTemplateBase

workflow/templateresolution/context_test.go:333–347  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

331}
332
333func TestWithTemplateBase(t *testing.T) {
334 ctx := logging.TestContext(t.Context())
335 wfClientset := fakewfclientset.NewSimpleClientset()
336 wftmpl := unmarshalWftmpl(baseWorkflowTemplateYaml)
337 log := logging.RequireLoggerFromContext(ctx)
338 tplCtx := NewContextFromClientSet(wfClientset.ArgoprojV1alpha1().WorkflowTemplates(metav1.NamespaceDefault), wfClientset.ArgoprojV1alpha1().ClusterWorkflowTemplates(), wftmpl, nil, log)
339
340 anotherWftmpl := unmarshalWftmpl(anotherWorkflowTemplateYaml)
341
342 // Get the template base of existing template name.
343 newCtx := tplCtx.WithTemplateBase(anotherWftmpl)
344 wftmpl, ok := newCtx.tmplBase.(*wfv1.WorkflowTemplate)
345 require.True(t, ok, "tmplBase is not a WorkflowTemplate")
346 assert.Equal(t, "another-workflow-template", wftmpl.Name)
347}
348
349func TestOnWorkflowTemplate(t *testing.T) {
350 wfClientset := fakewfclientset.NewSimpleClientset()

Callers

nothing calls this directly

Calls 9

TestContextFunction · 0.92
RequireLoggerFromContextFunction · 0.92
NewContextFromClientSetFunction · 0.85
WithTemplateBaseMethod · 0.80
unmarshalWftmplFunction · 0.70
ContextMethod · 0.65
WorkflowTemplatesMethod · 0.65
ArgoprojV1alpha1Method · 0.65

Tested by

no test coverage detected