[GitHub] dubeejw commented on a change in pull request #3254: Preserve rule status when rule is updated
dubeejw commented on a change in pull request #3254: Preserve rule status when rule is updated URL: https://github.com/apache/incubator-openwhisk/pull/3254#discussion_r168027670 ## File path: tests/src/test/scala/whisk/core/controller/test/RulesApiTests.scala ## @@ -563,7 +563,7 @@ class RulesApiTests extends ControllerTestCommon with WhiskRulesApi { WhiskRuleResponse( namespace, rule.name, - Status.ACTIVE, + Status.INACTIVE, Review comment: Status is set to `INACTIVE` in this file because the trigger route is not accessible in the unit test, resulting in an `INACTIVE` status when a rule is updated. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] dubeejw commented on a change in pull request #3254: Preserve rule status when rule is updated
dubeejw commented on a change in pull request #3254: Preserve rule status when rule is updated URL: https://github.com/apache/incubator-openwhisk/pull/3254#discussion_r168010760 ## File path: tests/src/test/scala/system/basic/WskRuleTests.scala ## @@ -88,6 +88,35 @@ abstract class WskRuleTests extends TestHelpers with WskTestHelpers { behavior of "Whisk rules" + it should "preserve rule status when a rule is updated" in withAssetCleaner(wskprops) { (wp, assetHelper) => +val ruleName = withTimestamp("r1to1") +val triggerName = withTimestamp("t1to1") +val actionName = withTimestamp("a1 to 1") +val triggerName2 = withTimestamp("t2to1") +val active = Some("active".toJson) +val inactive = Some("inactive".toJson) +val statusPermutations = + Seq((triggerName, active), (triggerName, inactive), (triggerName2, active), (triggerName2, inactive)) + +ruleSetup(Seq((ruleName, triggerName, (actionName, actionName, defaultAction))), assetHelper) +assetHelper.withCleaner(wsk.trigger, triggerName2) { (trigger, name) => + trigger.create(name) +} + +statusPermutations.foreach { Review comment: Makes sure `wsk rule update` and `wsk rule get` return the proper status. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] dubeejw commented on a change in pull request #3254: Preserve rule status when rule is updated
dubeejw commented on a change in pull request #3254: Preserve rule status when rule is updated URL: https://github.com/apache/incubator-openwhisk/pull/3254#discussion_r168009396 ## File path: core/controller/src/main/scala/whisk/core/controller/Rules.scala ## @@ -85,11 +85,31 @@ trait WhiskRulesApi extends WhiskCollectionAPI with ReferencedEntities { val request = content.resolve(entityName.namespace) onComplete(entitlementProvider.check(user, Privilege.READ, referencedEntities(request))) { case Success(_) => -putEntity(WhiskRule, entityStore, entityName.toDocId, overwrite, update(request) _, () => { - create(request, entityName) -}, postProcess = Some { rule: WhiskRule => - completeAsRuleResponse(rule, Status.ACTIVE) -}) +putEntity( + WhiskRule, + entityStore, + entityName.toDocId, + overwrite, + update(request) _, + () => { +create(request, entityName) + }, + postProcess = Some { rule: WhiskRule => +if (overwrite == true) { Review comment: Fetch the rule status only when an overwrite occurs. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services