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

Function TestConfigMapCacheLoadHit

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

Source from the content-addressed store, hash-verified

46}
47
48func TestConfigMapCacheLoadHit(t *testing.T) {
49 ctx := logging.TestContext(t.Context())
50 cancel, controller := newController(ctx)
51 defer cancel()
52
53 _, err := controller.kubeclientset.CoreV1().ConfigMaps("default").Create(ctx, &sampleConfigMapCacheEntry, metav1.CreateOptions{})
54 require.NoError(t, err)
55 c := cache.NewConfigMapCache("default", controller.kubeclientset, "whalesay-cache")
56
57 _, err = controller.kubeclientset.CoreV1().ConfigMaps("default").Get(ctx, sampleConfigMapCacheEntry.Name, metav1.GetOptions{})
58 require.NoError(t, err)
59
60 entry, err := c.Load(ctx, "hi-there-world")
61 require.NoError(t, err)
62 assert.True(t, entry.LastHitTimestamp.After(entry.CreationTimestamp.Time))
63
64 outputs := entry.Outputs
65 require.NoError(t, err)
66 require.Len(t, outputs.Parameters, 1)
67 assert.Equal(t, "hello", outputs.Parameters[0].Name)
68 assert.Equal(t, "foobar", outputs.Parameters[0].Value.String())
69}
70
71func TestConfigMapCacheLoadMiss(t *testing.T) {
72 ctx := logging.TestContext(t.Context())

Callers

nothing calls this directly

Calls 10

TestContextFunction · 0.92
NewConfigMapCacheFunction · 0.92
newControllerFunction · 0.85
cancelFunction · 0.85
ContextMethod · 0.65
CreateMethod · 0.65
GetMethod · 0.65
LoadMethod · 0.65
LenMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected