@@ -187,89 +187,6 @@ func TestApplyResourceMutation(t *testing.T) {
187187 },
188188 expected : `{"spec":[1,3]}` ,
189189 },
190-
191- // Rudi
192-
193- {
194- name : "Rudi: empty script" ,
195- inputData : `{"spec":{"secretName":"foo"}}` ,
196- mutation : syncagentv1alpha1.ResourceMutation {
197- Rudi : & syncagentv1alpha1.ResourceRudiMutation {
198- Script : `.` ,
199- },
200- },
201- expected : `{"spec":{"secretName":"foo"}}` ,
202- },
203- {
204- name : "Rudi: set one new key" ,
205- inputData : `{"spec":{"secretName":"foo"}}` ,
206- mutation : syncagentv1alpha1.ResourceMutation {
207- Rudi : & syncagentv1alpha1.ResourceRudiMutation {
208- Script : `(set! .foo "bar")` ,
209- },
210- },
211- expected : `{"foo":"bar","spec":{"secretName":"foo"}}` ,
212- },
213- {
214- name : "Rudi: update existing key" ,
215- inputData : `{"spec":{"secretName":"foo"}}` ,
216- mutation : syncagentv1alpha1.ResourceMutation {
217- Rudi : & syncagentv1alpha1.ResourceRudiMutation {
218- Script : `(set! .spec.secretName "bar")` ,
219- },
220- },
221- expected : `{"spec":{"secretName":"bar"}}` ,
222- },
223- {
224- name : "Rudi: remove a key" ,
225- inputData : `{"spec":{"secretName":"foo"}}` ,
226- mutation : syncagentv1alpha1.ResourceMutation {
227- Rudi : & syncagentv1alpha1.ResourceRudiMutation {
228- Script : `(delete! .spec.secretName)` ,
229- },
230- },
231- expected : `{"spec":{}}` ,
232- },
233- {
234- name : "Rudi: result value is ignored, only document counts" ,
235- inputData : `{"spec":{"secretName":"foo"}}` ,
236- mutation : syncagentv1alpha1.ResourceMutation {
237- Rudi : & syncagentv1alpha1.ResourceRudiMutation {
238- Script : `(delete! .spec.secretName) false` ,
239- },
240- },
241- expected : `{"spec":{}}` ,
242- },
243- {
244- name : "Rudi: local object becomes $localObj" ,
245- inputData : `{"spec":{"secretName":"foo"}}` ,
246- mutation : syncagentv1alpha1.ResourceMutation {
247- Rudi : & syncagentv1alpha1.ResourceRudiMutation {
248- Script : `(set! .spec $localObj.local)` ,
249- },
250- },
251- ctx : & TemplateMutationContext {
252- LocalObject : map [string ]any {
253- "local" : "data" ,
254- },
255- },
256- expected : `{"spec":"data"}` ,
257- },
258- {
259- name : "Rudi: remote object becomes $remoteObj" ,
260- inputData : `{"spec":{"secretName":"foo"}}` ,
261- mutation : syncagentv1alpha1.ResourceMutation {
262- Rudi : & syncagentv1alpha1.ResourceRudiMutation {
263- Script : `(set! .spec $remoteObj.remote)` ,
264- },
265- },
266- ctx : & TemplateMutationContext {
267- RemoteObject : map [string ]any {
268- "remote" : "data" ,
269- },
270- },
271- expected : `{"spec":"data"}` ,
272- },
273190 }
274191
275192 for _ , testcase := range testcases {
0 commit comments