Fixes #100 (#102)
Connect echo action to trigger with rule to ensure result has
activation identifier.
diff --git a/README.md b/README.md
index 81cdbb2..8d6af41 100644
--- a/README.md
+++ b/README.md
@@ -493,16 +493,16 @@
## Debugging
-Setting an environment parameter (`NODE_DEBUG=request`) will dump the HTTP requests from the client library and responses received to `stderr`.
+Setting an environment parameter (`DEBUG=needle`) will dump the HTTP requests from the client library and responses received to `stderr`.
```bash
-NODE_DEBUG=request node script.js
+DEBUG=needle node script.js
```
This parameter can also be set dynamically at runtime, provided this happens before the `openwhisk` module is required.
```javascript
-process.env.NODE_DEBUG='request';
+process.env.DEBUG='needle';
var openwhisk = require('openwhisk');
```
diff --git a/test/integration/triggers.test.js b/test/integration/triggers.test.js
index 4b68e2b..04515db 100644
--- a/test/integration/triggers.test.js
+++ b/test/integration/triggers.test.js
@@ -5,11 +5,12 @@
const test = require('ava')
const Triggers = require('../../lib/triggers.js')
+const Rules = require('../../lib/rules.js')
const Client = require('../../lib/client.js')
const Utils = require('./utils.js')
const envParams = ['API_KEY', 'API_HOST', 'NAMESPACE']
-const options = Utils.autoOptions();
+const options = Utils.autoOptions()
// check that mandatory configuration properties are available
envParams.forEach(key => {
@@ -52,7 +53,7 @@
test('get a non-existing trigger, expecting 404', async t => {
const triggers = new Triggers(new Client(options))
await triggers.get({name: 'glorfindel'}).catch(err => {
- t.is(err.statusCode, 404)
+ t.is(err.statusCode, 404)
})
})
@@ -107,11 +108,16 @@
}
const triggers = new Triggers(new Client(options))
+ const rules = new Rules(new Client(options))
+
return triggers.create({triggerName: 'random_fire_test'}).then(result => {
- return triggers.invoke({triggerName: 'random_fire_test'}).then(update_result => {
- t.true(update_result.hasOwnProperty('activationId'))
- t.pass()
- return triggers.delete({triggerName: 'random_fire_test'}).catch(errors)
+ return rules.create({ruleName: 'echo_rule', action: `/whisk.system/utils/echo`, trigger: `/${NAMESPACE}/random_fire_test`}).then(rule_result => {
+ return triggers.invoke({triggerName: 'random_fire_test'}).then(update_result => {
+ t.true(update_result.hasOwnProperty('activationId'))
+ t.pass()
+ return triggers.delete({triggerName: 'random_fire_test'})
+ .then(() => rules.delete({ruleName: 'echo_rule'}))
+ }).catch(errors)
}).catch(errors)
}).catch(errors)
})