This is an automated email from the ASF dual-hosted git repository.
mcdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-client-js.git
The following commit(s) were added to refs/heads/master by this push:
new 5b313c1 Add concurrency to the limits map to allow the client to
request conrrency limits (#218)
5b313c1 is described below
commit 5b313c1ab8d96f1437f477e03fa1cb14e2f6eb03
Author: dan mcweeney <[email protected]>
AuthorDate: Mon Feb 22 09:19:03 2021 -0500
Add concurrency to the limits map to allow the client to request conrrency
limits (#218)
---
lib/main.d.ts | 1 +
test/unit/actions.test.js | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/lib/main.d.ts b/lib/main.d.ts
index b843190..c515554 100644
--- a/lib/main.d.ts
+++ b/lib/main.d.ts
@@ -262,6 +262,7 @@ declare namespace openwhisk {
timeout?: number;
memory?: number;
logs?: number;
+ concurrency?: number;
}
interface Response<T extends Dict> {
diff --git a/test/unit/actions.test.js b/test/unit/actions.test.js
index a1f2f60..09343c6 100644
--- a/test/unit/actions.test.js
+++ b/test/unit/actions.test.js
@@ -455,6 +455,26 @@ test('create a new action with limits', t => {
return actions.create({ name: '12345', action, limits })
})
+test('create a new action with concurrency setting', t => {
+ t.plan(4)
+ const ns = '_'
+ const client = {}
+ const action = 'function main() { // main function body};'
+ const limits = {
+ concurrency: 2
+ }
+ const actions = new Actions(client)
+
+ client.request = (method, path, options) => {
+ t.is(method, 'PUT')
+ t.is(path, `namespaces/${ns}/actions/12345`)
+ t.deepEqual(options.qs, {})
+ t.deepEqual(options.body, { exec: { kind: 'nodejs:default', code: action
}, limits: { concurrency: 2 } })
+ }
+
+ return actions.create({ name: '12345', action, limits })
+})
+
test('create an action without providing an action body', t => {
const actions = new Actions()
t.throws(() => actions.create({ name: '12345' }), /Missing mandatory action/)