This is an automated email from the ASF dual-hosted git repository.

mcdan pushed a commit to branch mcdan/action-concurrency
in repository https://gitbox.apache.org/repos/asf/openwhisk-client-js.git

commit e10af13a332c46844323f5326f9872deedb186ea
Author: mcweeney <[email protected]>
AuthorDate: Fri Feb 19 19:26:23 2021 -0500

    Add concurrency to the limits map to allow the client to request conrrency 
limits
---
 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/)

Reply via email to