@@ -357,4 +357,39 @@ class WskActionTests extends TestHelpers with WskTestHelpers with JsHelpers with
357
357
}
358
358
}
359
359
360
+ it should " not delete previous annotation when update action with new annotation" in withAssetCleaner(wskprops) {
361
+ (wp, assetHelper) =>
362
+ val name = " hello"
363
+
364
+ assetHelper.withCleaner(wsk.action, name) { (action, _) =>
365
+ val annotations = Map (" key1" -> " value1" .toJson, " key2" -> " value2" .toJson)
366
+ action.create(name, Some (TestUtils .getTestActionFilename(" hello.js" )), annotations = annotations)
367
+ val annotationString = wsk.parseJsonString(wsk.action.get(name).stdout).fields(" annotations" ).toString
368
+
369
+ annotationString should include(""" "key":"key1"""" )
370
+ annotationString should include(""" "value":"value1"""" )
371
+ annotationString should include(""" "key":"key2"""" )
372
+ annotationString should include(""" "value":"value2"""" )
373
+
374
+ val newAnnotations = Map (" key3" -> " value3" .toJson, " key4" -> " value4" .toJson)
375
+ action.create(
376
+ name,
377
+ Some (TestUtils .getTestActionFilename(" hello.js" )),
378
+ annotations = newAnnotations,
379
+ update = true )
380
+ val newAnnotationString = wsk.parseJsonString(wsk.action.get(name).stdout).fields(" annotations" ).toString
381
+
382
+ newAnnotationString should include(""" "key":"key1"""" )
383
+ newAnnotationString should include(""" "value":"value1"""" )
384
+ newAnnotationString should include(""" "key":"key2"""" )
385
+ newAnnotationString should include(""" "value":"value2"""" )
386
+ newAnnotationString should include(""" "key":"key3"""" )
387
+ newAnnotationString should include(""" "value":"value3"""" )
388
+ newAnnotationString should include(""" "key":"key4"""" )
389
+ newAnnotationString should include(""" "value":"value4"""" )
390
+
391
+ action.create(name, Some (TestUtils .getTestActionFilename(" hello.js" )), update = true )
392
+ }
393
+ }
394
+
360
395
}
0 commit comments