(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func 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 | } |
nothing calls this directly
no test coverage detected