add test to enforce rule cannot be created for action used as trigger
#3.088 geöffnet am 11. Dez. 2017
Repository-Metriken
- Stars
- (6.777 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 17h 31m) (3 gemergte PRs in 30 T)
Beschreibung
When I create Rule Follow the steps below, my action was overwritten.
- create 'A' action
- create rule :
wsk rule create myRule A myAction - 'A' action is overwritten. It change to trigger
When openwhisk create rule, it just check documet is exist. not check it is action or trigger. (https://github.com/apache/incubator-openwhisk/blob/master/core/controller/src/main/scala/whisk/core/controller/Rules.scala#L378)
after that, add rule property to my 'A' action. and store it to couch db as trigger. (https://github.com/apache/incubator-openwhisk/blob/master/core/controller/src/main/scala/whisk/core/controller/Rules.scala#L280)
i tried to check before add rule to action by use trigger views rule.
var isTrigger = function (doc) { return (doc.exec === undefined && doc.binding === undefined && doc.parameters !== undefined) };
but the result of select already lost that properties.
so, i think openwhisk have to add entity type property(action , trigger , rule) when entities are created.
after that, we can check entity type before make trigger.
what do you think about this idea??