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

Function TestConfigMapCacheSave

workflow/controller/cache_test.go:84–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestConfigMapCacheSave(t *testing.T) {
85 var MockParamValue = "Hello world"
86 MockParam := wfv1.Parameter{
87 Name: "hello",
88 Value: wfv1.AnyStringPtr(MockParamValue),
89 }
90 ctx := logging.TestContext(t.Context())
91 cancel, controller := newController(ctx)
92 defer cancel()
93 c := cache.NewConfigMapCache("default", controller.kubeclientset, "whalesay-cache")
94
95 outputs := wfv1.Outputs{}
96 outputs.Parameters = append(outputs.Parameters, MockParam)
97 err := c.Save(ctx, "hi-there-world", "", &outputs)
98 require.NoError(t, err)
99
100 cm, err := controller.kubeclientset.CoreV1().ConfigMaps("default").Get(ctx, "whalesay-cache", metav1.GetOptions{})
101 require.NoError(t, err)
102 assert.NotNil(t, cm)
103 var entry cache.Entry
104 wfv1.MustUnmarshal([]byte(cm.Data["hi-there-world"]), &entry)
105 assert.Equal(t, entry.LastHitTimestamp.Time, entry.CreationTimestamp.Time)
106}

Callers

nothing calls this directly

Calls 7

TestContextFunction · 0.92
NewConfigMapCacheFunction · 0.92
newControllerFunction · 0.85
cancelFunction · 0.85
ContextMethod · 0.65
SaveMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected