This is an automated email from the ASF dual-hosted git repository. dubeejw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git
The following commit(s) were added to refs/heads/master by this push: new bfd4f0b Use utils from incubator-openwhisk and rename duplicate tests to be accurate (#270) bfd4f0b is described below commit bfd4f0b4727fbaf8cb57140dca579db73cc1384c Author: David Cariello <drcar...@us.ibm.com> AuthorDate: Fri Apr 13 13:19:06 2018 -0500 Use utils from incubator-openwhisk and rename duplicate tests to be accurate (#270) * rename instead of merge apigwtests * remove CLI utils * remove test action code and rely on incubator-openwhisk to host master list * use sleep.js instead of timeout --- tests/dat/actions/applicationError.js | 3 - tests/dat/actions/argCheck.js | 3 - tests/dat/actions/asyncError.js | 3 - tests/dat/actions/base64Web.js | 9 -- tests/dat/actions/blackbox.zip | Bin 256 -> 0 bytes tests/dat/actions/cat.js | 13 -- tests/dat/actions/corsHeaderMod.js | 12 -- tests/dat/actions/countdown.js | 20 --- tests/dat/actions/echo-web-http.js | 10 -- tests/dat/actions/echo.js | 6 - tests/dat/actions/empty.js | 0 tests/dat/actions/emptyJSONResult.js | 2 - tests/dat/actions/head.js | 14 -- tests/dat/actions/hello.js | 8 -- tests/dat/actions/hello.py | 27 ---- tests/dat/actions/hello.swift | 10 -- tests/dat/actions/helloAsync.js | 19 --- tests/dat/actions/helloContext.js | 10 -- tests/dat/actions/helloDeadline.js | 24 ---- tests/dat/actions/helloJava.jar | Bin 1082 -> 0 bytes tests/dat/actions/helloJavaDefaultPackage.jar | Bin 1288 -> 0 bytes tests/dat/actions/helloOpenwhiskPackage.js | 26 ---- tests/dat/actions/helloPromise.js | 9 -- tests/dat/actions/initexit.js | 1 - tests/dat/actions/initforever.js | 1 - tests/dat/actions/invalidInput1.json | 3 - tests/dat/actions/invalidInput2.json | 4 - tests/dat/actions/invalidInput3.json | 2 - tests/dat/actions/invalidInput4.json | 3 - tests/dat/actions/issue-1562.js | 6 - tests/dat/actions/log.js | 7 - tests/dat/actions/malformed.js | 1 - tests/dat/actions/malformed.py | 2 - tests/dat/actions/multipleHeaders.js | 8 -- tests/dat/actions/niam.js | 3 - tests/dat/actions/niam.py | 6 - tests/dat/actions/niam.swift | 4 - tests/dat/actions/ping.js | 27 ---- tests/dat/actions/pngWeb.js | 13 -- tests/dat/actions/printParams.js | 25 ---- tests/dat/actions/python.zip | Bin 726 -> 0 bytes tests/dat/actions/python2_virtualenv.zip | Bin 3644338 -> 0 bytes tests/dat/actions/python3_virtualenv.zip | Bin 3804236 -> 0 bytes tests/dat/actions/pythonVersion.py | 25 ---- tests/dat/actions/runexit.js | 3 - tests/dat/actions/sort.js | 14 -- tests/dat/actions/split.js | 14 -- tests/dat/actions/stdenv.py | 7 - tests/dat/actions/textBody.js | 8 -- tests/dat/actions/timeout.js | 18 --- tests/dat/actions/validInput1.json | 11 -- tests/dat/actions/validInput2.json | 3 - tests/dat/actions/wc.js | 10 -- tests/dat/actions/wcbin.js | 26 ---- tests/dat/actions/zippedaction.zip | Bin 51940 -> 0 bytes .../apigw/endpoints.without.action.swagger.json | 76 ----------- tests/dat/apigw/local.api.bad.yaml | 35 ----- tests/dat/apigw/local.api.yaml | 31 ----- tests/dat/apigw/testswaggerdoc1 | 61 --------- tests/dat/apigw/testswaggerdoc1V2 | 61 --------- tests/dat/apigw/testswaggerdoc2 | 117 ---------------- tests/dat/apigw/testswaggerdoc2V2 | 117 ---------------- tests/dat/apigw/testswaggerdocinvalid | 12 -- tests/src/test/scala/common/TestCLIUtils.scala | 32 ----- .../scala/system/basic/WskCliActionTests.scala | 4 +- ...{WskBasicTests.scala => WskCliBasicTests.scala} | 71 +++++----- .../{ApiGwTests.scala => ApiGwCliBasicTests.scala} | 38 +++--- .../scala/whisk/core/cli/test/ApiGwCliTests.scala | 2 +- .../scala/whisk/core/cli/test/WskApiGwTests.scala | 14 +- ...sageTests.scala => WskCliBasicUsageTests.scala} | 147 ++++++++++----------- 70 files changed, 133 insertions(+), 1168 deletions(-) diff --git a/tests/dat/actions/applicationError.js b/tests/dat/actions/applicationError.js deleted file mode 100644 index bc8a39d..0000000 --- a/tests/dat/actions/applicationError.js +++ /dev/null @@ -1,3 +0,0 @@ -function main(args) { - return { error: "This error thrown on purpose by the action."}; -} diff --git a/tests/dat/actions/argCheck.js b/tests/dat/actions/argCheck.js deleted file mode 100644 index 3220bfd..0000000 --- a/tests/dat/actions/argCheck.js +++ /dev/null @@ -1,3 +0,0 @@ -function main(params) { - return {payload: params.payload}; -} diff --git a/tests/dat/actions/asyncError.js b/tests/dat/actions/asyncError.js deleted file mode 100644 index 44686d7..0000000 --- a/tests/dat/actions/asyncError.js +++ /dev/null @@ -1,3 +0,0 @@ -function main(params) { - return Promise.reject({msg: 'failed activation on purpose'}); -} diff --git a/tests/dat/actions/base64Web.js b/tests/dat/actions/base64Web.js deleted file mode 100644 index 3e4773e..0000000 --- a/tests/dat/actions/base64Web.js +++ /dev/null @@ -1,9 +0,0 @@ -function main() { - return { - headers: { - "content-type": "application/json" - }, - statusCode: 200, - body: new Buffer(JSON.stringify({'status': 'success'})).toString('base64') - } -} diff --git a/tests/dat/actions/blackbox.zip b/tests/dat/actions/blackbox.zip deleted file mode 100644 index d66f3e3..0000000 Binary files a/tests/dat/actions/blackbox.zip and /dev/null differ diff --git a/tests/dat/actions/cat.js b/tests/dat/actions/cat.js deleted file mode 100644 index 4d73e56..0000000 --- a/tests/dat/actions/cat.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Equivalent to unix cat command. - * Return all the lines in an array. All other fields in the input message are stripped. - * @param lines An array of strings. - */ -function main(msg) { - var lines = msg.lines || []; - var retn = {lines: lines, payload: lines.join("\n")}; - console.log('cat: returning ' + JSON.stringify(retn)); - return retn; -} - - diff --git a/tests/dat/actions/corsHeaderMod.js b/tests/dat/actions/corsHeaderMod.js deleted file mode 100644 index df9b704..0000000 --- a/tests/dat/actions/corsHeaderMod.js +++ /dev/null @@ -1,12 +0,0 @@ -function main() { - return { - headers: { - "Access-Control-Allow-Origin": "Origin set from Web Action", - "Access-Control-Allow-Headers": "Headers set from Web Action", - "Access-Control-Allow-Methods": "Methods set from Web Action", - "Location": "openwhisk.org", - "Set-Cookie": "cookie-cookie-cookie" - }, - statusCode: 200 - } -} diff --git a/tests/dat/actions/countdown.js b/tests/dat/actions/countdown.js deleted file mode 100644 index 520eb95..0000000 --- a/tests/dat/actions/countdown.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * An action that invokes itself recursively, programmatically using the whisk - * Javascript API. - */ -var openwhisk = require('openwhisk') - -function main(params) { - var wsk = openwhisk({ignore_certs: true}) - - var n = parseInt(params.n); - console.log(n); - if (n === 0) { - console.log('Happy New Year!'); - } else if (n > 0) { - return wsk.actions.invoke({ - actionName: process.env['__OW_ACTION_NAME'], - params: { n: n - 1 } - }); - } -} diff --git a/tests/dat/actions/echo-web-http.js b/tests/dat/actions/echo-web-http.js deleted file mode 100644 index 1fabbaa..0000000 --- a/tests/dat/actions/echo-web-http.js +++ /dev/null @@ -1,10 +0,0 @@ -function main(params) { - var bodyobj = params || {}; - bodystr = JSON.stringify(bodyobj); - return { - statusCode: 200, - headers: { 'Content-Type': 'application/json' }, - body: new Buffer(bodystr).toString('base64') - }; -} - diff --git a/tests/dat/actions/echo.js b/tests/dat/actions/echo.js deleted file mode 100644 index 37df10b..0000000 --- a/tests/dat/actions/echo.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Returns params, or an empty string if no parameter values are provided - */ -function main(params) { - return params || {}; -} diff --git a/tests/dat/actions/empty.js b/tests/dat/actions/empty.js deleted file mode 100644 index e69de29..0000000 diff --git a/tests/dat/actions/emptyJSONResult.js b/tests/dat/actions/emptyJSONResult.js deleted file mode 100644 index b3ffc0a..0000000 --- a/tests/dat/actions/emptyJSONResult.js +++ /dev/null @@ -1,2 +0,0 @@ -function main(params) { -} diff --git a/tests/dat/actions/head.js b/tests/dat/actions/head.js deleted file mode 100644 index f6d5487..0000000 --- a/tests/dat/actions/head.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Return the first num lines of an array. - * @param lines An array of strings. - * @param num Number of lines to return. - */ -function main(msg) { - var lines = msg.lines || []; - var num = msg.num || 1; - var head = lines.slice(0, num); - console.log('head get first ' + num + ' lines of ' + lines + ': ' + head); - return {lines: head, num: num}; -} - - diff --git a/tests/dat/actions/hello.js b/tests/dat/actions/hello.js deleted file mode 100644 index 82b3bcf..0000000 --- a/tests/dat/actions/hello.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Hello, world. - */ -function main(params) { - greeting = 'hello, ' + params.payload + '!' - console.log(greeting); - return {payload: greeting} -} diff --git a/tests/dat/actions/hello.py b/tests/dat/actions/hello.py deleted file mode 100644 index d2639d5..0000000 --- a/tests/dat/actions/hello.py +++ /dev/null @@ -1,27 +0,0 @@ -"""Python Hello test. - -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -""" - - -def main(args): - """Main.""" - name = args.get('name', 'stranger') - greeting = 'Hello ' + name + '!' - print(greeting) - return {'greeting': greeting} diff --git a/tests/dat/actions/hello.swift b/tests/dat/actions/hello.swift deleted file mode 100644 index 7c903a5..0000000 --- a/tests/dat/actions/hello.swift +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Hello world as a Swift Whisk action. - */ -func main(args: [String:Any]) -> [String:Any] { - if let name = args["name"] as? String { - return [ "greeting" : "Hello \(name)!" ] - } else { - return [ "greeting" : "Hello stranger!" ] - } -} diff --git a/tests/dat/actions/helloAsync.js b/tests/dat/actions/helloAsync.js deleted file mode 100644 index 2c0acdf..0000000 --- a/tests/dat/actions/helloAsync.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * word count utility, coded as an asynchronous action for pedagogical - * purposes - */ -function wc(params) { - var str = params.payload; - var words = str.split(" "); - var count = words.length; - console.log("The message '"+str+"' has", count, 'words'); - return {count: count}; -} - -function main(params) { - return new Promise(function(resolve, reject) { - setTimeout(function () { - resolve(wc(params)); - }, 100); - }); -} diff --git a/tests/dat/actions/helloContext.js b/tests/dat/actions/helloContext.js deleted file mode 100644 index d4957d9..0000000 --- a/tests/dat/actions/helloContext.js +++ /dev/null @@ -1,10 +0,0 @@ -function main(args) { - return { - "api_host": process.env['__OW_API_HOST'], - "api_key": process.env['__OW_API_KEY'], - "namespace": process.env['__OW_NAMESPACE'], - "action_name": process.env['__OW_ACTION_NAME'], - "activation_id": process.env['__OW_ACTIVATION_ID'], - "deadline": process.env['__OW_DEADLINE'] - } -} diff --git a/tests/dat/actions/helloDeadline.js b/tests/dat/actions/helloDeadline.js deleted file mode 100644 index 8e97307..0000000 --- a/tests/dat/actions/helloDeadline.js +++ /dev/null @@ -1,24 +0,0 @@ -function main(args) { - - var deadline = process.env['__OW_DEADLINE'] - var timeleft = deadline - new Date().getTime() - console.log("deadline in " + timeleft + " msecs"); - - var timer = function () { - var timeleft = deadline - new Date().getTime() - console.log("deadline in " + timeleft + " msecs"); - } - var alarm = setInterval(timer, 1000); - - return new Promise(function(resolve, reject) { - setTimeout(function() { - clearInterval(alarm); - if (args.forceHang) { - // do not resolve the promise and make the action timeout - } else { - resolve({ timedout: true }); - } - }, timeleft - 500); - }) - -} diff --git a/tests/dat/actions/helloJava.jar b/tests/dat/actions/helloJava.jar deleted file mode 100644 index a8f49ee..0000000 Binary files a/tests/dat/actions/helloJava.jar and /dev/null differ diff --git a/tests/dat/actions/helloJavaDefaultPackage.jar b/tests/dat/actions/helloJavaDefaultPackage.jar deleted file mode 100644 index 5a7a9f3..0000000 Binary files a/tests/dat/actions/helloJavaDefaultPackage.jar and /dev/null differ diff --git a/tests/dat/actions/helloOpenwhiskPackage.js b/tests/dat/actions/helloOpenwhiskPackage.js deleted file mode 100644 index 5ecd6c2..0000000 --- a/tests/dat/actions/helloOpenwhiskPackage.js +++ /dev/null @@ -1,26 +0,0 @@ -var openwhisk = require('openwhisk') - -function main(args) { - var wsk = openwhisk({ignore_certs: args.ignore_certs}) - - return new Promise(function (resolve, reject) { - return wsk.actions.list().then(list => { - console.log("action list has this many actions:", list.length) - if (args.name) { - console.log('deleting') - return wsk.actions.delete({actionName: args.name}).then(result => { - resolve({delete: true}) - }).catch(function (reason) { - console.log('error', reason) - reject(reason) - }) - } else { - console.log('ok') - resolve({list: true}) - } - }).catch(function (reason) { - console.log('error', reason) - reject(reason); - }) - }) -} diff --git a/tests/dat/actions/helloPromise.js b/tests/dat/actions/helloPromise.js deleted file mode 100644 index 36903de..0000000 --- a/tests/dat/actions/helloPromise.js +++ /dev/null @@ -1,9 +0,0 @@ -function main(args) { - return new Promise(function(resolve, reject) { - setTimeout(function() { - resolve({ - done : true - }); - }, 2000); - }) -} diff --git a/tests/dat/actions/initexit.js b/tests/dat/actions/initexit.js deleted file mode 100644 index 6cee2e1..0000000 --- a/tests/dat/actions/initexit.js +++ /dev/null @@ -1 +0,0 @@ -process.exit(1); diff --git a/tests/dat/actions/initforever.js b/tests/dat/actions/initforever.js deleted file mode 100644 index 1fa180e..0000000 --- a/tests/dat/actions/initforever.js +++ /dev/null @@ -1 +0,0 @@ -while (true) {} diff --git a/tests/dat/actions/invalidInput1.json b/tests/dat/actions/invalidInput1.json deleted file mode 100644 index da57a79..0000000 --- a/tests/dat/actions/invalidInput1.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "invalidJSON": -} diff --git a/tests/dat/actions/invalidInput2.json b/tests/dat/actions/invalidInput2.json deleted file mode 100644 index 275fa9f..0000000 --- a/tests/dat/actions/invalidInput2.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "invalid": "JS - ON" -} diff --git a/tests/dat/actions/invalidInput3.json b/tests/dat/actions/invalidInput3.json deleted file mode 100644 index 3272df5..0000000 --- a/tests/dat/actions/invalidInput3.json +++ /dev/null @@ -1,2 +0,0 @@ -{ - "invalid": "JSON" diff --git a/tests/dat/actions/invalidInput4.json b/tests/dat/actions/invalidInput4.json deleted file mode 100644 index 9a6393d..0000000 --- a/tests/dat/actions/invalidInput4.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "invalid": "JS"ON" -} diff --git a/tests/dat/actions/issue-1562.js b/tests/dat/actions/issue-1562.js deleted file mode 100644 index 9064817..0000000 --- a/tests/dat/actions/issue-1562.js +++ /dev/null @@ -1,6 +0,0 @@ -// We expect this action to always result in errored activations. -function main(args) { - return new Promise((resolve, reject) => { - reject(); - }); -} diff --git a/tests/dat/actions/log.js b/tests/dat/actions/log.js deleted file mode 100644 index bfbd513..0000000 --- a/tests/dat/actions/log.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Emit strings to stdout/stderr. - */ -function main() { - console.log("this is stdout"); - console.error("this is stderr"); -} diff --git a/tests/dat/actions/malformed.js b/tests/dat/actions/malformed.js deleted file mode 100644 index 587be6b..0000000 --- a/tests/dat/actions/malformed.js +++ /dev/null @@ -1 +0,0 @@ -x diff --git a/tests/dat/actions/malformed.py b/tests/dat/actions/malformed.py deleted file mode 100644 index 6cedc32..0000000 --- a/tests/dat/actions/malformed.py +++ /dev/null @@ -1,2 +0,0 @@ -"""Invalid Python comment test.""" -// invalid python comment # noqa -- tell linters to ignore the intentional syntax error diff --git a/tests/dat/actions/multipleHeaders.js b/tests/dat/actions/multipleHeaders.js deleted file mode 100644 index f19e236..0000000 --- a/tests/dat/actions/multipleHeaders.js +++ /dev/null @@ -1,8 +0,0 @@ -function main() { - return { - headers: { - "Set-Cookie": ["a=b", "c=d"] - }, - statusCode: 200 - } -} diff --git a/tests/dat/actions/niam.js b/tests/dat/actions/niam.js deleted file mode 100644 index 378201d..0000000 --- a/tests/dat/actions/niam.js +++ /dev/null @@ -1,3 +0,0 @@ -function niam(args) { - return { 'greetings': 'Hello from a non-standard entrypoint.' }; -} diff --git a/tests/dat/actions/niam.py b/tests/dat/actions/niam.py deleted file mode 100644 index 30a4945..0000000 --- a/tests/dat/actions/niam.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Python Non-standard entry point test.""" - - -def niam(args): - """Non-standard entry point.""" - return {"greetings": "Hello from a non-standard entrypoint."} diff --git a/tests/dat/actions/niam.swift b/tests/dat/actions/niam.swift deleted file mode 100644 index c85a34c..0000000 --- a/tests/dat/actions/niam.swift +++ /dev/null @@ -1,4 +0,0 @@ -/* Swift action with a non-default entry point. */ -func niam(args: [String:Any]) -> [String:Any] { - return [ "greetings" : "Hello from a non-standard entrypoint." ] -} diff --git a/tests/dat/actions/ping.js b/tests/dat/actions/ping.js deleted file mode 100644 index fda3066..0000000 --- a/tests/dat/actions/ping.js +++ /dev/null @@ -1,27 +0,0 @@ -function main(msg) { - var hostToPing = msg.payload; - console.log('Pinging to ' + hostToPing); - - var spawn = require('child_process').exec; - var promise = new Promise(function(resolve, reject) { - var child = spawn('ping -c 3 ' + hostToPing); - - var tmp = {stdout: "", stderr: ""}; - - child.stdout.on('data', function (data) { - tmp.stdout = tmp.stdout + data; - }); - - child.stderr.on('data', function (data) { - tmp.stderr = tmp.stderr + data; - }); - - child.on('close', function () { - console.log('stdout', tmp.stdout); - console.log('stderr', tmp.stderr); - resolve(tmp); - }); - }); - - return promise; -} diff --git a/tests/dat/actions/pngWeb.js b/tests/dat/actions/pngWeb.js deleted file mode 100644 index 3a644b0..0000000 --- a/tests/dat/actions/pngWeb.js +++ /dev/null @@ -1,13 +0,0 @@ -function main() { - var png = "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAGCAYAAAD68A/GAAAA/klEQVQYGWNgAAEHBxaG//+ZQMyyn581Pfas+cRQnf1LfF" + - "Ljf+62smUgcUbt0FA2Zh7drf/ffMy9vLn3RurrW9e5hCU11i2azfD4zu1/DHz8TAy/foUxsXBrFzHzC7r8+M9S1vn1qxQT07" + - "dDjL9fdemrqKxlYGT6z8AIMo6hgeUfA0PUvy9fGFh5GWK3z7vNxSWt++jX99+8SoyiGQwsW38w8PJEM7x5v5SJ8f+/xv8MDA" + - "zffv9hevfkWjiXBGMpMx+j2awovjcMjFztDO8+7GF49LkbZDCDeXLTWnZO7qDfn1/+5jbw/8pjYWS4wZLztXnuEuYTk2M+Mz" + - "Iw/AcA36VewaD6fzsAAAAASUVORK5CYII=" - - return { - statusCode: 200, - headers: {'content-type': 'image/png'}, - body: png - } -} diff --git a/tests/dat/actions/printParams.js b/tests/dat/actions/printParams.js deleted file mode 100644 index d150738..0000000 --- a/tests/dat/actions/printParams.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Print the parameters to the console, sorted alphabetically by key - */ -function main(params) { - var sep = ''; - var retn = {}; - var keys = []; - - for (var key in params) { - if (params.hasOwnProperty(key)) { - keys.push(key); - } - } - - keys.sort(); - for (var i in keys) { - var key = keys[i]; - var value = params[key]; - console.log(sep + 'params.' + key + ':', value); - sep = ' '; - retn[key] = value; - } - - return {params: retn}; -} diff --git a/tests/dat/actions/python.zip b/tests/dat/actions/python.zip deleted file mode 100644 index 070ccc2..0000000 Binary files a/tests/dat/actions/python.zip and /dev/null differ diff --git a/tests/dat/actions/python2_virtualenv.zip b/tests/dat/actions/python2_virtualenv.zip deleted file mode 100644 index 4808c8a..0000000 Binary files a/tests/dat/actions/python2_virtualenv.zip and /dev/null differ diff --git a/tests/dat/actions/python3_virtualenv.zip b/tests/dat/actions/python3_virtualenv.zip deleted file mode 100644 index 3f40a15..0000000 Binary files a/tests/dat/actions/python3_virtualenv.zip and /dev/null differ diff --git a/tests/dat/actions/pythonVersion.py b/tests/dat/actions/pythonVersion.py deleted file mode 100644 index 3fc6955..0000000 --- a/tests/dat/actions/pythonVersion.py +++ /dev/null @@ -1,25 +0,0 @@ -"""Python Version test. - -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -""" - -import sys - -def main(args): - """Main.""" - return {"version": sys.version_info.major} diff --git a/tests/dat/actions/runexit.js b/tests/dat/actions/runexit.js deleted file mode 100644 index 78fbdd9..0000000 --- a/tests/dat/actions/runexit.js +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - process.exit(1); -} diff --git a/tests/dat/actions/sort.js b/tests/dat/actions/sort.js deleted file mode 100644 index 2017bcf..0000000 --- a/tests/dat/actions/sort.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Sort a set of lines. - * @param lines An array of strings to sort. - */ -function main(msg) { - var lines = msg.lines || []; - //console.log('sort got ' + lines.length + ' lines'); - console.log('sort input msg: ' + JSON.stringify(msg)); - console.log('sort before: ' + lines); - lines.sort(); - console.log('sort after: ' + lines); - return {lines: lines, length: lines.length}; -} - diff --git a/tests/dat/actions/split.js b/tests/dat/actions/split.js deleted file mode 100644 index 43d36bc..0000000 --- a/tests/dat/actions/split.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Splits a string into an array of strings - * Return lines in an array. - * @param payload A string. - * @param separator The character, or the regular expression, to use for splitting the string - */ -function main(msg) { - var separator = msg.separator || /\r?\n/; - var payload = msg.payload.toString(); - var lines = payload.split(separator); - var retn = {lines: lines, payload: msg.payload}; - console.log('split: returning ' + JSON.stringify(retn)); - return retn; -} diff --git a/tests/dat/actions/stdenv.py b/tests/dat/actions/stdenv.py deleted file mode 100644 index fa39dfd..0000000 --- a/tests/dat/actions/stdenv.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Unify action container environments.""" -import os - - -def main(dict): - return {"auth": os.environ['__OW_API_KEY'], - "edge": os.environ['__OW_API_HOST']} diff --git a/tests/dat/actions/textBody.js b/tests/dat/actions/textBody.js deleted file mode 100644 index caf45d0..0000000 --- a/tests/dat/actions/textBody.js +++ /dev/null @@ -1,8 +0,0 @@ -function main() { - return { - headers: { - 'Content-Type': 'text/html' - }, - body: 'plain text' - }; -} diff --git a/tests/dat/actions/timeout.js b/tests/dat/actions/timeout.js deleted file mode 100644 index f3bc74b..0000000 --- a/tests/dat/actions/timeout.js +++ /dev/null @@ -1,18 +0,0 @@ -function sleep(milliseconds) { - var start = new Date().getTime(); - while (true) { - var now = new Date().getTime(); - if ((now - start) > milliseconds){ - break; - } - } -} - -function main(msg) { - console.log('dosTimeout', 'timeout ' + msg.payload+''); - var n = msg.payload; - sleep(n); - var res = "[OK] message terminated successfully after " + msg.payload + " milliseconds."; - console.log('dosTimeout', 'result:', res); - return {msg: res}; -} diff --git a/tests/dat/actions/validInput1.json b/tests/dat/actions/validInput1.json deleted file mode 100644 index 19ec7c9..0000000 --- a/tests/dat/actions/validInput1.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "a key": "a value", - "a bool": true, - "objKey": {"b": "c"}, - "objKey2": {"another object": {"some string": "1111"}}, - "objKey3": {"json object": {"some int": 1111}}, - "a number arr": [1,2,3], - "a string arr": ["1", "2", "3"], - "a bool arr": [true, false, true], - "strThatLooksLikeJSON": "{\"someKey\": \"someValue\"}" -} diff --git a/tests/dat/actions/validInput2.json b/tests/dat/actions/validInput2.json deleted file mode 100644 index 36ddda4..0000000 --- a/tests/dat/actions/validInput2.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "payload": "test" -} diff --git a/tests/dat/actions/wc.js b/tests/dat/actions/wc.js deleted file mode 100644 index 842fc61..0000000 --- a/tests/dat/actions/wc.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * word count utility - */ -function main(params) { - var str = params.payload.toString(); - var words = str.split(" "); - var count = words.length; - console.log("The message '"+str+"' has", count, 'words'); - return { count: count }; -} diff --git a/tests/dat/actions/wcbin.js b/tests/dat/actions/wcbin.js deleted file mode 100644 index 6b47b6b..0000000 --- a/tests/dat/actions/wcbin.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Return word count as a binary number. This demonstrates the use of a blocking - * invoke. - */ -var openwhisk = require('openwhisk') - -function main(params) { - var wsk = openwhisk({ignore_certs: true}) - - var str = params.payload; - console.log("The payload is '" + str + "'"); - - return wsk.actions.invoke({ - actionName: 'wc', - params: { - payload: str - }, - blocking: true - }).then(activation => { - var wordsInDecimal = activation.response.result.count; - var wordsInBinary = wordsInDecimal.toString(2) + ' (base 2)'; - return { - binaryCount: wordsInBinary - }; - }); -} diff --git a/tests/dat/actions/zippedaction.zip b/tests/dat/actions/zippedaction.zip deleted file mode 100644 index 14cbd4c..0000000 Binary files a/tests/dat/actions/zippedaction.zip and /dev/null differ diff --git a/tests/dat/apigw/endpoints.without.action.swagger.json b/tests/dat/apigw/endpoints.without.action.swagger.json deleted file mode 100644 index 2305643..0000000 --- a/tests/dat/apigw/endpoints.without.action.swagger.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "swagger": "2.0", - "basePath": "/NoActions", - "info": { - "title": "A descriptive name", - "version": "1.0" - }, - "paths": { - "/": { - "delete": { - "operationId": "", - "responses": { - "200": { - "description": "A successful invocation response" - } - } - }, - "get": { - "operationId": "", - "responses": { - "200": { - "description": "A successful invocation response" - } - } - }, - "head": { - "operationId": "", - "responses": { - "200": { - "description": "A successful invocation response" - } - } - }, - "options": { - "operationId": "", - "responses": { - "200": { - "description": "A successful invocation response" - } - } - }, - "patch": { - "operationId": "", - "responses": { - "200": { - "description": "A successful invocation response" - } - } - }, - "post": { - "operationId": "", - "responses": { - "200": { - "description": "A successful invocation response" - } - } - }, - "put": { - "operationId": "", - "responses": { - "200": { - "description": "A successful invocation response" - } - } - } - } - }, - "x-ibm-configuration": { - "assembly": { - "execute": [] - }, - "cors": { - "enabled": true - } - } -} diff --git a/tests/dat/apigw/local.api.bad.yaml b/tests/dat/apigw/local.api.bad.yaml deleted file mode 100644 index 35a49e7..0000000 --- a/tests/dat/apigw/local.api.bad.yaml +++ /dev/null @@ -1,35 +0,0 @@ -some bad yaml in -these []]] -lines: - -basePath: /bp -info: - title: /bp - version: 1.0.0 -paths: - /rp: - get: - operationId: get_/rp - responses: - default: - description: Default response - x-openwhisk: - action: webhttpecho - namespace: guest - package: "" - url: https://127.0.0.1/api/v1/web/guest/default/webhttpecho.http -swagger: "2.0" -x-ibm-configuration: - assembly: - execute: - - operation-switch: - case: - - execute: - - invoke: - target-url: https://127.0.0.1/api/v1/web/guest/default/webhttpecho.http - verb: keep - operations: - - get_/rp - cors: - enabled: true - diff --git a/tests/dat/apigw/local.api.yaml b/tests/dat/apigw/local.api.yaml deleted file mode 100644 index 6a1a2b2..0000000 --- a/tests/dat/apigw/local.api.yaml +++ /dev/null @@ -1,31 +0,0 @@ -basePath: /bp -info: - title: /bp - version: 1.0.0 -paths: - /rp: - get: - operationId: get_/rp - responses: - default: - description: Default response - x-openwhisk: - action: webhttpecho - namespace: guest - package: "" - url: https://127.0.0.1/api/v1/web/guest/default/webhttpecho.http -swagger: "2.0" -x-ibm-configuration: - assembly: - execute: - - operation-switch: - case: - - execute: - - invoke: - target-url: https://127.0.0.1/api/v1/web/guest/default/webhttpecho.http - verb: keep - operations: - - get_/rp - cors: - enabled: true - diff --git a/tests/dat/apigw/testswaggerdoc1 b/tests/dat/apigw/testswaggerdoc1 deleted file mode 100644 index 623ae43..0000000 --- a/tests/dat/apigw/testswaggerdoc1 +++ /dev/null @@ -1,61 +0,0 @@ -{ - "swagger": "2.0", - "basePath": "/CLI_APIGWTEST7_bp", - "info": { - "title": "CLI_APIGWTEST7 API Name", - "version": "1.0.0" - }, - "paths": { - "/path": { - "get": { - "operationId": "get_/path", - "responses": { - "default": { - "description": "Default response" - } - }, - "x-openwhisk": { - "action": "CLI_APIGWTEST7_action", - "namespace": "whisk.system", - "package": "", - "url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http" - } - } - } - }, - "x-ibm-configuration": { - "assembly": { - "execute": [ - { - "set-variable": { - "actions": [ - { - "set": "message.headers.Authorization", - "value": "Basic Nzg5YzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOmFiY3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A=" - } - ] - } - }, - { - "operation-switch": { - "case": [ - { - "execute": [ - { - "invoke": { - "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http", - "verb": "keep" - } - } - ], - "operations": [ - "get_/path" - ] - } - ] - } - } - ] - } - } -} diff --git a/tests/dat/apigw/testswaggerdoc1V2 b/tests/dat/apigw/testswaggerdoc1V2 deleted file mode 100644 index 623ae43..0000000 --- a/tests/dat/apigw/testswaggerdoc1V2 +++ /dev/null @@ -1,61 +0,0 @@ -{ - "swagger": "2.0", - "basePath": "/CLI_APIGWTEST7_bp", - "info": { - "title": "CLI_APIGWTEST7 API Name", - "version": "1.0.0" - }, - "paths": { - "/path": { - "get": { - "operationId": "get_/path", - "responses": { - "default": { - "description": "Default response" - } - }, - "x-openwhisk": { - "action": "CLI_APIGWTEST7_action", - "namespace": "whisk.system", - "package": "", - "url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http" - } - } - } - }, - "x-ibm-configuration": { - "assembly": { - "execute": [ - { - "set-variable": { - "actions": [ - { - "set": "message.headers.Authorization", - "value": "Basic Nzg5YzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOmFiY3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A=" - } - ] - } - }, - { - "operation-switch": { - "case": [ - { - "execute": [ - { - "invoke": { - "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http", - "verb": "keep" - } - } - ], - "operations": [ - "get_/path" - ] - } - ] - } - } - ] - } - } -} diff --git a/tests/dat/apigw/testswaggerdoc2 b/tests/dat/apigw/testswaggerdoc2 deleted file mode 100644 index 2556853..0000000 --- a/tests/dat/apigw/testswaggerdoc2 +++ /dev/null @@ -1,117 +0,0 @@ -{ - "swagger": "2.0", - "basePath": "/test1/v1", - "info": { - "title": "CLI_APIGWTEST13 API Name", - "version": "1.0.0" - }, - "paths": { - "/whisk_system/utils/echo": { - "get": { - "operationId": "get_/whisk_system/utils/echo", - "responses": { - "default": { - "description": "Default response" - } - }, - "x-openwhisk": { - "action": "test1a", - "namespace": "whisk.system", - "package": "", - "url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http" - } - }, - "post": { - "operationId": "post_/whisk_system/utils/echo", - "responses": { - "default": { - "description": "Default response" - } - }, - "x-openwhisk": { - "action": "test1a", - "namespace": "whisk.system", - "package": "", - "url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http" - } - } - }, - "/whisk_system/utils/split": { - "post": { - "operationId": "post_/whisk_system/utils/split", - "responses": { - "default": { - "description": "Default response" - } - }, - "x-openwhisk": { - "action": "test1a", - "namespace": "whisk.system", - "package": "", - "url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http" - } - } - } - }, - "x-ibm-configuration": { - "assembly": { - "execute": [ - { - "set-variable": { - "actions": [ - { - "set": "message.headers.Authorization", - "value": "Basic Nzg5YzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOmFiY3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A=" - } - ] - } - }, - { - "operation-switch": { - "case": [ - { - "operations": [ - "get_/whisk_system/utils/echo" - ], - "execute": [ - { - "invoke": { - "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http", - "verb": "get" - } - } - ] - }, - { - "operations": [ - "post_/whisk_system/utils/echo" - ], - "execute": [ - { - "invoke": { - "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http", - "verb": "post" - } - } - ] - }, - { - "operations": [ - "post_/whisk_system/utils/split" - ], - "execute": [ - { - "invoke": { - "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http", - "verb": "post" - } - } - ] - } - ] - } - } - ] - } - } -} diff --git a/tests/dat/apigw/testswaggerdoc2V2 b/tests/dat/apigw/testswaggerdoc2V2 deleted file mode 100644 index 2556853..0000000 --- a/tests/dat/apigw/testswaggerdoc2V2 +++ /dev/null @@ -1,117 +0,0 @@ -{ - "swagger": "2.0", - "basePath": "/test1/v1", - "info": { - "title": "CLI_APIGWTEST13 API Name", - "version": "1.0.0" - }, - "paths": { - "/whisk_system/utils/echo": { - "get": { - "operationId": "get_/whisk_system/utils/echo", - "responses": { - "default": { - "description": "Default response" - } - }, - "x-openwhisk": { - "action": "test1a", - "namespace": "whisk.system", - "package": "", - "url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http" - } - }, - "post": { - "operationId": "post_/whisk_system/utils/echo", - "responses": { - "default": { - "description": "Default response" - } - }, - "x-openwhisk": { - "action": "test1a", - "namespace": "whisk.system", - "package": "", - "url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http" - } - } - }, - "/whisk_system/utils/split": { - "post": { - "operationId": "post_/whisk_system/utils/split", - "responses": { - "default": { - "description": "Default response" - } - }, - "x-openwhisk": { - "action": "test1a", - "namespace": "whisk.system", - "package": "", - "url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http" - } - } - } - }, - "x-ibm-configuration": { - "assembly": { - "execute": [ - { - "set-variable": { - "actions": [ - { - "set": "message.headers.Authorization", - "value": "Basic Nzg5YzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOmFiY3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A=" - } - ] - } - }, - { - "operation-switch": { - "case": [ - { - "operations": [ - "get_/whisk_system/utils/echo" - ], - "execute": [ - { - "invoke": { - "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http", - "verb": "get" - } - } - ] - }, - { - "operations": [ - "post_/whisk_system/utils/echo" - ], - "execute": [ - { - "invoke": { - "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http", - "verb": "post" - } - } - ] - }, - { - "operations": [ - "post_/whisk_system/utils/split" - ], - "execute": [ - { - "invoke": { - "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/test1a.http", - "verb": "post" - } - } - ] - } - ] - } - } - ] - } - } -} diff --git a/tests/dat/apigw/testswaggerdocinvalid b/tests/dat/apigw/testswaggerdocinvalid deleted file mode 100644 index 8d13ca4..0000000 --- a/tests/dat/apigw/testswaggerdocinvalid +++ /dev/null @@ -1,12 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "/", - "version": "1.0.0" - }, - "paths": { - "/test1": { - - } - } -} \ No newline at end of file diff --git a/tests/src/test/scala/common/TestCLIUtils.scala b/tests/src/test/scala/common/TestCLIUtils.scala deleted file mode 100644 index de824b1..0000000 --- a/tests/src/test/scala/common/TestCLIUtils.scala +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package common - -object TestCLIUtils { - - def getTestActionFilename(fileName: String): String = { - val testDir = scala.util.Properties.userDir.toString() - s"$testDir/dat/actions/$fileName" - } - - def getTestApiGwFilename(fileName: String): String = { - val testDir = scala.util.Properties.userDir.toString() - s"$testDir/dat/apigw/$fileName" - } - -} diff --git a/tests/src/test/scala/system/basic/WskCliActionTests.scala b/tests/src/test/scala/system/basic/WskCliActionTests.scala index 7e008bf..042f0bd 100644 --- a/tests/src/test/scala/system/basic/WskCliActionTests.scala +++ b/tests/src/test/scala/system/basic/WskCliActionTests.scala @@ -20,7 +20,7 @@ package system.basic import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner -import common.TestCLIUtils +import common.TestUtils import common.TestUtils.NOT_ALLOWED import common.Wsk @@ -29,7 +29,7 @@ class WskCliActionTests extends WskActionTests { override val wsk = new Wsk it should "not be able to use --kind and --docker at the same time when running action create or update" in { - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") Seq(false, true).foreach { updateValue => val out = wsk.action.create(name = "kindAndDockerAction", artifact = Some(file), expectedExitCode = NOT_ALLOWED, kind = Some("nodejs:6"), docker = Some("mydockerimagename"), update = updateValue) diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala b/tests/src/test/scala/system/basic/WskCliBasicTests.scala similarity index 94% rename from tests/src/test/scala/system/basic/WskBasicTests.scala rename to tests/src/test/scala/system/basic/WskCliBasicTests.scala index 2759578..decf861 100644 --- a/tests/src/test/scala/system/basic/WskBasicTests.scala +++ b/tests/src/test/scala/system/basic/WskCliBasicTests.scala @@ -27,7 +27,6 @@ import org.scalatest.junit.JUnitRunner import common.ActivationResult import common.TestHelpers -import common.TestCLIUtils import common.TestUtils import common.TestUtils._ import common.Wsk @@ -39,20 +38,12 @@ import spray.json.pimpAny import whisk.http.Messages -object WskCliTestHelpers { - /** - * Append the current timestamp in ms - */ - def withTimestamp(text: String) = s"${text}-${System.currentTimeMillis}" - -} - @RunWith(classOf[JUnitRunner]) -class WskBasicTests extends TestHelpers with WskTestHelpers { +class WskCliBasicTests extends TestHelpers with WskTestHelpers { implicit val wskprops = WskProps() val wsk = new Wsk - val defaultAction = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val defaultAction = Some(TestUtils.getTestActionFilename("hello.js")) behavior of "Wsk CLI" @@ -197,7 +188,7 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { it should "create, update, get and list an action" in withAssetCleaner(wskprops) { (wp, assetHelper) => val name = "createAndUpdate" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) val params = Map("a" -> "A".toJson) assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, file, parameters = params) @@ -216,7 +207,7 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { it should "reject create of an action that already exists" in withAssetCleaner(wskprops) { val name = "dupeAction" - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val file = Some(TestUtils.getTestActionFilename("echo.js")) (wp, assetHelper) => assetHelper.withCleaner(wsk.action, name) { (action, _) => @@ -268,7 +259,7 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { assetHelper.withCleaner(wsk.action, name) { // this docker image will be need to be pulled from dockerhub and hence has to be published there first (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("blackbox.zip")), kind = Some("native")) + action.create(name, Some(TestUtils.getTestActionFilename("blackbox.zip")), kind = Some("native")) } val run = wsk.action.invoke(name, Map()) @@ -283,8 +274,8 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { it should "create, and invoke an action using a parameter file" in withAssetCleaner(wskprops) { val name = "paramFileAction" - val file = Some(TestCLIUtils.getTestActionFilename("argCheck.js")) - val argInput = Some(TestCLIUtils.getTestActionFilename("validInput2.json")) + val file = Some(TestUtils.getTestActionFilename("argCheck.js")) + val argInput = Some(TestUtils.getTestActionFilename("validInput2.json")) (wp, assetHelper) => assetHelper.withCleaner(wsk.action, name) { (action, _) => @@ -344,7 +335,7 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { (wp, assetHelper) => val name = "MALFORMED" assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("malformed.js"))) + action.create(name, Some(TestUtils.getTestActionFilename("malformed.js"))) } val run = wsk.action.invoke(name, Map("payload" -> "whatever".toJson)) @@ -363,7 +354,7 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { val boolErrInput = Map("error" -> true.toJson) assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("echo.js"))) + action.create(name, Some(TestUtils.getTestActionFilename("echo.js"))) } Seq(strErrInput, numErrInput, boolErrInput) foreach { input => @@ -387,7 +378,7 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { (wp, assetHelper) => val name = "errorResponseObject" assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("asyncError.js"))) + action.create(name, Some(TestUtils.getTestActionFilename("asyncError.js"))) } val stderr = wsk.action.invoke(name, blocking = true, expectedExitCode = 246).stderr @@ -399,7 +390,7 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { it should "invoke a blocking action and get only the result" in withAssetCleaner(wskprops) { (wp, assetHelper) => val name = "basicInvoke" assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("wc.js"))) + action.create(name, Some(TestUtils.getTestActionFilename("wc.js"))) } wsk.action @@ -440,7 +431,7 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { val name = "emptyJSONAction" assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("emptyJSONResult.js"))) + action.create(name, Some(TestUtils.getTestActionFilename("emptyJSONResult.js"))) } val stdout = wsk.action.invoke(name, result = true).stdout @@ -450,10 +441,10 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { it should "create, and invoke an action that times out to ensure the proper response is received" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "sleepAction" - val params = Map("payload" -> "100000".toJson) + val params = Map("sleepTimeInMs" -> 100000.toJson) val allowedActionDuration = 120 seconds val res = assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("timeout.js")), timeout = Some(allowedActionDuration)) + action.create(name, Some(TestUtils.getTestActionFilename("sleep.js")), timeout = Some(allowedActionDuration)) action.invoke(name, parameters = params, result = true, expectedExitCode = ACCEPTED) } @@ -473,9 +464,9 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { behavior of "Wsk Trigger CLI" it should "create, update, get, fire and list trigger" in withAssetCleaner(wskprops) { (wp, assetHelper) => - val ruleName = WskCliTestHelpers.withTimestamp("r1toa1") - val triggerName = WskCliTestHelpers.withTimestamp("t1tor1") - val actionName = WskCliTestHelpers.withTimestamp("a1") + val ruleName = withTimestamp("r1toa1") + val triggerName = withTimestamp("t1tor1") + val actionName = withTimestamp("a1") val params = Map("a" -> "A".toJson) val ns = wsk.namespace.whois() @@ -575,9 +566,9 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { } it should "create, and fire a trigger using a parameter file" in withAssetCleaner(wskprops) { - val ruleName = WskCliTestHelpers.withTimestamp("r1toa1") - val triggerName = WskCliTestHelpers.withTimestamp("paramFileTrigger") - val actionName = WskCliTestHelpers.withTimestamp("a1") + val ruleName = withTimestamp("r1toa1") + val triggerName = withTimestamp("paramFileTrigger") + val actionName = withTimestamp("a1") val argInput = Some(TestUtils.getTestActionFilename("validInput2.json")) (wp, assetHelper) => @@ -643,9 +634,9 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { } it should "create, and fire a trigger to ensure result is empty" in withAssetCleaner(wskprops) { (wp, assetHelper) => - val ruleName = WskCliTestHelpers.withTimestamp("r1toa1") - val triggerName = WskCliTestHelpers.withTimestamp("emptyResultTrigger") - val actionName = WskCliTestHelpers.withTimestamp("a1") + val ruleName = withTimestamp("r1toa1") + val triggerName = withTimestamp("emptyResultTrigger") + val actionName = withTimestamp("a1") assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, _) => trigger.create(triggerName) @@ -697,11 +688,11 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { it should "create and fire a trigger with a rule whose action has been deleted" in withAssetCleaner(wskprops) { (wp, assetHelper) => - val ruleName1 = WskCliTestHelpers.withTimestamp("r1toa1") - val ruleName2 = WskCliTestHelpers.withTimestamp("r2toa2") - val triggerName = WskCliTestHelpers.withTimestamp("t1tor1r2") - val actionName1 = WskCliTestHelpers.withTimestamp("a1") - val actionName2 = WskCliTestHelpers.withTimestamp("a2") + val ruleName1 = withTimestamp("r1toa1") + val ruleName2 = withTimestamp("r2toa2") + val triggerName = withTimestamp("t1tor1r2") + val actionName1 = withTimestamp("a1") + val actionName2 = withTimestamp("a2") val ns = wsk.namespace.whois() assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, _) => @@ -929,9 +920,9 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { it should "create a trigger, and fire a trigger to get its individual fields from an activation" in withAssetCleaner( wskprops) { (wp, assetHelper) => - val ruleName = WskCliTestHelpers.withTimestamp("r1toa1") - val triggerName = WskCliTestHelpers.withTimestamp("activationFields") - val actionName = WskCliTestHelpers.withTimestamp("a1") + val ruleName = withTimestamp("r1toa1") + val triggerName = withTimestamp("activationFields") + val actionName = withTimestamp("a1") assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, _) => trigger.create(triggerName) diff --git a/tests/src/test/scala/whisk/core/cli/test/ApiGwTests.scala b/tests/src/test/scala/whisk/core/cli/test/ApiGwCliBasicTests.scala similarity index 96% rename from tests/src/test/scala/whisk/core/cli/test/ApiGwTests.scala rename to tests/src/test/scala/whisk/core/cli/test/ApiGwCliBasicTests.scala index c9aa550..0a44abe 100644 --- a/tests/src/test/scala/whisk/core/cli/test/ApiGwTests.scala +++ b/tests/src/test/scala/whisk/core/cli/test/ApiGwCliBasicTests.scala @@ -33,7 +33,7 @@ import com.jayway.restassured.config.SSLConfig import common.TestUtils._ import common.TestUtils import common.WhiskProperties -import common.{TestCLIUtils, WhiskProperties, WskProps} +import common.{TestUtils, WhiskProperties, WskProps} import scala.concurrent.duration.DurationInt import scala.util.parsing.json.JSON @@ -45,7 +45,7 @@ import org.apache.commons.io.FileUtils * Tests for testing the CLI "api" subcommand. Most of these tests require a deployed backend. */ @RunWith(classOf[JUnitRunner]) -abstract class ApiGwTests extends BaseApiGwTests { +abstract class ApiGwCliBasicTests extends BaseApiGwTests { val clinamespace = wsk.namespace.whois() val createCode: Int @@ -402,7 +402,7 @@ abstract class ApiGwTests extends BaseApiGwTests { try { println("cli namespace: " + clinamespace) // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -438,7 +438,7 @@ abstract class ApiGwTests extends BaseApiGwTests { println("cli namespace: " + clinamespace) // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -470,7 +470,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val actionName = testName + "_action" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -498,7 +498,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val actionName = testName + "_action" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -526,7 +526,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val actionName = testName + "_action" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -555,7 +555,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val newEndpoint = "/newEndpoint" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -596,7 +596,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val testurlop = "get" val testapiname = testName + " API Name" val actionName = testName + "_action" - val swaggerPath = TestCLIUtils.getTestApiGwFilename("testswaggerdoc1") + val swaggerPath = TestUtils.getTestApiGwFilename("testswaggerdoc1") try { var rr = apiCreate(swagger = Some(swaggerPath)) verifyApiCreated(rr) @@ -623,7 +623,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val newEndpoint = "/newEndpoint" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -696,7 +696,7 @@ abstract class ApiGwTests extends BaseApiGwTests { println("cli namespace: " + clinamespace) // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -724,7 +724,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val testurlop = "get" val testapiname = testName + " API Name" val actionName = testName + "_action" - val swaggerPath = TestCLIUtils.getTestApiGwFilename(s"testswaggerdocinvalid") + val swaggerPath = TestUtils.getTestApiGwFilename(s"testswaggerdocinvalid") try { val rr = apiCreate(swagger = Some(swaggerPath), expectedExitCode = ANY_ERROR_EXIT) println("api create stdout: " + rr.stdout) @@ -745,7 +745,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val actionName = testName + "_action" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -783,7 +783,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val actionName = testName + "_action" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -823,7 +823,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val testurlop2 = "post" val testapiname = testName + " API Name" val actionName = "test1a" - val swaggerPath = TestCLIUtils.getTestApiGwFilename(s"testswaggerdoc2") + val swaggerPath = TestUtils.getTestApiGwFilename(s"testswaggerdoc2") try { var rr = apiCreate(swagger = Some(swaggerPath)) println("api create stdout: " + rr.stdout) @@ -849,7 +849,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val actionName = testName + "_action" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -894,7 +894,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val responseType = "http" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) var rr = apiCreate( @@ -927,7 +927,7 @@ abstract class ApiGwTests extends BaseApiGwTests { val testbasepath = "/NoActions" val testrelpath = "/" val testops: Seq[String] = Seq("put", "delete", "get", "head", "options", "patch", "post") - val swaggerPath = TestCLIUtils.getTestApiGwFilename(s"endpoints.without.action.swagger.json") + val swaggerPath = TestUtils.getTestApiGwFilename(s"endpoints.without.action.swagger.json") try { var rr = apiCreate(swagger = Some(swaggerPath)) @@ -964,7 +964,7 @@ abstract class ApiGwTests extends BaseApiGwTests { try { // Create the action for the API. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = createCode, web = Some("true")) // Set an invalid auth key diff --git a/tests/src/test/scala/whisk/core/cli/test/ApiGwCliTests.scala b/tests/src/test/scala/whisk/core/cli/test/ApiGwCliTests.scala index 3465815..4dfe20f 100644 --- a/tests/src/test/scala/whisk/core/cli/test/ApiGwCliTests.scala +++ b/tests/src/test/scala/whisk/core/cli/test/ApiGwCliTests.scala @@ -32,7 +32,7 @@ import scala.util.parsing.json.JSON * Tests for basic CLI usage. Some of these tests require a deployed backend. */ @RunWith(classOf[JUnitRunner]) -class ApiGwCliTests extends ApiGwTests { +class ApiGwCliTests extends ApiGwCliBasicTests { override lazy val wsk: common.Wsk = new Wsk override lazy val createCode = SUCCESS_EXIT behavior of "Cli Wsk api creation with path parameters no swagger" diff --git a/tests/src/test/scala/whisk/core/cli/test/WskApiGwTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskApiGwTests.scala index 25dab82..364fde0 100644 --- a/tests/src/test/scala/whisk/core/cli/test/WskApiGwTests.scala +++ b/tests/src/test/scala/whisk/core/cli/test/WskApiGwTests.scala @@ -22,7 +22,7 @@ import org.scalatest.junit.JUnitRunner import common.JsHelpers import common.StreamLogging -import common.TestCLIUtils +import common.TestUtils import common.TestUtils.ANY_ERROR_EXIT import common.TestUtils.DONTCARE_EXIT import common.TestUtils.SUCCESS_EXIT @@ -271,7 +271,7 @@ class WskApiGwTests extends BaseApiGwTests with WskActorSystem with JsHelpers wi val actionName = testName + "_action" try { // Create the action for the API. It must NOT be a "web-action" action for this test - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = SUCCESS_EXIT) val rr = apiCreate( @@ -299,7 +299,7 @@ class WskApiGwTests extends BaseApiGwTests with WskActorSystem with JsHelpers wi it should "list api alphabetically by Base/Rel/Verb" in { val baseName = "/BaseTestPathApiList" val actionName = "actionName" - val file = TestCLIUtils.getTestActionFilename(s"echo-web-http.js") + val file = TestUtils.getTestActionFilename(s"echo-web-http.js") try { // Create Action for apis var action = @@ -346,7 +346,7 @@ class WskApiGwTests extends BaseApiGwTests with WskActorSystem with JsHelpers wi val responseType = "http" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = SUCCESS_EXIT, web = Some("true")) var rr = apiCreate( @@ -377,7 +377,7 @@ class WskApiGwTests extends BaseApiGwTests with WskActorSystem with JsHelpers wi val responseType = "http" try { // Create the action for the API. It must be a "web-action" action. - val file = TestCLIUtils.getTestActionFilename(s"echo.js") + val file = TestUtils.getTestActionFilename(s"echo.js") wsk.action.create(name = actionName, artifact = Some(file), expectedExitCode = SUCCESS_EXIT, web = Some("true")) var rr = apiCreate( @@ -407,7 +407,7 @@ class WskApiGwTests extends BaseApiGwTests with WskActorSystem with JsHelpers wi val testurlop = "get" val testapiname = testbasepath val actionName = "webhttpecho" - val swaggerPath = TestCLIUtils.getTestApiGwFilename(s"local.api.yaml") + val swaggerPath = TestUtils.getTestApiGwFilename(s"local.api.yaml") try { var rr = apiCreate(swagger = Some(swaggerPath)) println("api create stdout: " + rr.stdout) @@ -425,7 +425,7 @@ class WskApiGwTests extends BaseApiGwTests with WskActorSystem with JsHelpers wi it should "reject creation of an API from invalid YAML formatted API configuration file" in { val testName = "CLI_APIGWTEST22" val testbasepath = "/" + testName + "_bp" - val swaggerPath = TestCLIUtils.getTestApiGwFilename(s"local.api.bad.yaml") + val swaggerPath = TestUtils.getTestApiGwFilename(s"local.api.bad.yaml") try { val rr = apiCreate(swagger = Some(swaggerPath), expectedExitCode = ANY_ERROR_EXIT) println("api create stdout: " + rr.stdout) diff --git a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskCliBasicUsageTests.scala similarity index 94% rename from tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala rename to tests/src/test/scala/whisk/core/cli/test/WskCliBasicUsageTests.scala index cbacaba..0e8ab1c 100644 --- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala +++ b/tests/src/test/scala/whisk/core/cli/test/WskCliBasicUsageTests.scala @@ -27,11 +27,10 @@ import scala.language.postfixOps import scala.concurrent.duration.Duration import scala.concurrent.duration.DurationInt import scala.util.Random -import system.basic.WskCliTestHelpers import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import common.TestHelpers -import common.TestCLIUtils +import common.TestUtils import common.TestUtils._ import common.WhiskProperties import common.Wsk @@ -52,11 +51,11 @@ import whisk.http.Messages * Tests for basic CLI usage. Some of these tests require a deployed backend. */ @RunWith(classOf[JUnitRunner]) -class WskBasicUsageTests extends TestHelpers with WskTestHelpers { +class WskCliBasicUsageTests extends TestHelpers with WskTestHelpers { implicit val wskprops = WskProps() val wsk = new Wsk - val defaultAction = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val defaultAction = Some(TestUtils.getTestActionFilename("hello.js")) val usrAgentHeaderRegEx = """\bUser-Agent\b": \[\s+"OpenWhisk\-CLI/1.\d+.*""" behavior of "Wsk CLI usage" @@ -93,10 +92,10 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "allow a 3 part Fully Qualified Name (FQN) without a leading '/'" in withAssetCleaner( wskprops) { (wp, assetHelper) => val guestNamespace = wsk.namespace.whois() - val packageName = WskCliTestHelpers.withTimestamp("packageName3ptFQN") - val actionName = WskCliTestHelpers.withTimestamp("actionName3ptFQN") - val triggerName = WskCliTestHelpers.withTimestamp("triggerName3ptFQN") - val ruleName = WskCliTestHelpers.withTimestamp("ruleName3ptFQN") + val packageName = withTimestamp("packageName3ptFQN") + val actionName = withTimestamp("actionName3ptFQN") + val triggerName = withTimestamp("triggerName3ptFQN") + val ruleName = withTimestamp("ruleName3ptFQN") val fullQualifiedName = s"${guestNamespace}/${packageName}/${actionName}" // Used for action and rule creation below assetHelper.withCleaner(wsk.pkg, packageName) { (pkg, _) => @@ -160,7 +159,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { wskprops) { (wp, assetHelper) => // Create dummy action to update val name = "updateMissingFile" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) assetHelper.withCleaner(wsk.action, name) { (action, name) => action.create(name, file) } @@ -174,7 +173,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "reject action update for sequence with no components" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "updateMissingComponents" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) assetHelper.withCleaner(wsk.action, name) { (action, name) => action.create(name, file) } @@ -188,7 +187,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "create, and get an action to verify parameter and annotation parsing" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "actionAnnotations" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, @@ -221,8 +220,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "create, and get an action to verify file parameter and annotation parsing" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "actionAnnotAndParamParsing" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) - val argInput = Some(TestCLIUtils.getTestActionFilename("validInput1.json")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) + val argInput = Some(TestUtils.getTestActionFilename("validInput1.json")) assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, @@ -255,7 +254,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "create an action with the proper parameter and annotation escapes" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "actionEscapes" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, @@ -290,7 +289,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { val name = "abort init" assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, - Some(TestCLIUtils.getTestActionFilename("initexit.js"))) + Some(TestUtils.getTestActionFilename("initexit.js"))) } withActivation(wsk.activation, wsk.action.invoke(name)) { activation => @@ -307,7 +306,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { val name = "hang init" assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, - Some(TestCLIUtils.getTestActionFilename("initforever.js")), + Some(TestUtils.getTestActionFilename("initforever.js")), timeout = Some(3 seconds)) } @@ -326,7 +325,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { val name = "abort run" assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, - Some(TestCLIUtils.getTestActionFilename("runexit.js"))) + Some(TestUtils.getTestActionFilename("runexit.js"))) } withActivation(wsk.activation, wsk.action.invoke(name)) { activation => @@ -386,7 +385,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { (wp, assetHelper) => assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("log.js"))) + action.create(name, Some(TestUtils.getTestActionFilename("log.js"))) } withActivation(wsk.activation, wsk.action.invoke(name)) { activation => @@ -407,7 +406,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { (wp, assetHelper) => assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, - Some(TestCLIUtils.getTestActionFilename("argCheck.js"))) + Some(TestUtils.getTestActionFilename("argCheck.js"))) } val run = wsk.action.invoke(name) @@ -432,7 +431,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, - Some(TestCLIUtils.getTestActionFilename("helloAsync.js")), + Some(TestUtils.getTestActionFilename("helloAsync.js")), memory = Some(memoryLimit), timeout = Some(timeLimit), logsize = Some(logLimit)) @@ -466,7 +465,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { "invalid kind", confirmDelete = false) { (action, name) => action.create(name, - Some(TestCLIUtils.getTestActionFilename("echo.js")), + Some(TestUtils.getTestActionFilename("echo.js")), kind = Some("foobar"), expectedExitCode = BAD_REQUEST) } @@ -477,7 +476,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { wskprops) { (wp, assetHelper) => val name = "zipWithNoKind" val zippedPythonAction = - Some(TestCLIUtils.getTestActionFilename("python.zip")) + Some(TestUtils.getTestActionFilename("python.zip")) val createResult = assetHelper.withCleaner(wsk.action, name, confirmDelete = false) { (action, _) => @@ -526,7 +525,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { action.create( name, Some( - TestCLIUtils.getTestActionFilename("helloOpenwhiskPackage.js"))) + TestUtils.getTestActionFilename("helloOpenwhiskPackage.js"))) } val run = wsk.action @@ -548,7 +547,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { val name = "context" assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, - Some(TestCLIUtils.getTestActionFilename("helloContext.js"))) + Some(TestUtils.getTestActionFilename("helloContext.js"))) } val start = Instant.now(Clock.systemUTC()).toEpochMilli @@ -569,7 +568,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { wskprops) { (wp, assetHelper) => val name = "invokeResult" assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("echo.js"))) + action.create(name, Some(TestUtils.getTestActionFilename("echo.js"))) } val args = Map("hello" -> "Robert".toJson) val run = wsk.action.invoke(name, args, blocking = true, result = true) @@ -582,7 +581,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create( name, - Some(TestCLIUtils.getTestActionFilename("helloDeadline.js")), + Some(TestUtils.getTestActionFilename("helloDeadline.js")), timeout = Some(3 seconds)) } @@ -605,7 +604,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create( name, - Some(TestCLIUtils.getTestActionFilename("helloDeadline.js")), + Some(TestUtils.getTestActionFilename("helloDeadline.js")), timeout = Some(3 seconds)) } @@ -634,7 +633,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "ensure --web flags set the proper annotations" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "webaction" - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val file = Some(TestUtils.getTestActionFilename("echo.js")) assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, file) @@ -667,7 +666,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "ensure action update with --web flag only copies existing annotations when new annotations are not provided" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "webaction" - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val file = Some(TestUtils.getTestActionFilename("echo.js")) val createKey = "createKey" val createValue = JsString("createValue") val updateKey = "updateKey" @@ -723,7 +722,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "ensure action update creates an action with --web flag" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "webaction" - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val file = Some(TestUtils.getTestActionFilename("echo.js")) assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, file, web = Some("true"), update = true) @@ -744,7 +743,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "reject action create and update with invalid --web flag input" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "webaction" - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val file = Some(TestUtils.getTestActionFilename("echo.js")) val invalidInput = "bogus" val errorMsg = s"Invalid argument '$invalidInput' for --web flag. Valid input consist of 'yes', 'true', 'raw', 'false', or 'no'." @@ -765,8 +764,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "reject action create and update when --web-secure used on a non-web action" in withAssetCleaner( wskprops) { (wp, assetHelper) => - val name = WskCliTestHelpers.withTimestamp("nonwebaction") - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val name = withTimestamp("nonwebaction") + val file = Some(TestUtils.getTestActionFilename("echo.js")) val errorMsg = s"The --web-secure option is only valid when the --web option is enabled." @@ -804,8 +803,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "generate a require-whisk-annotation --web-secure used on a web action" in withAssetCleaner( wskprops) { (wp, assetHelper) => - val name = WskCliTestHelpers.withTimestamp("webaction") - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val name = withTimestamp("webaction") + val file = Some(TestUtils.getTestActionFilename("echo.js")) val secretStr = "my-secret" // -web true --web-secure true -> annotation "require-whisk-auth" value is an int @@ -882,8 +881,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "remove existing require-whisk-annotation when --web-secure is false" in withAssetCleaner( wskprops) { (wp, assetHelper) => - val name = WskCliTestHelpers.withTimestamp("webaction") - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val name = withTimestamp("webaction") + val file = Some(TestUtils.getTestActionFilename("echo.js")) val secretStr = "my-secret" // @@ -917,7 +916,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "ensure action update with --web-secure flag only copies existing annotations when new annotations are not provided" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "webaction" - val file = Some(TestCLIUtils.getTestActionFilename("echo.js")) + val file = Some(TestUtils.getTestActionFilename("echo.js")) val createKey = "createKey" val createValue = JsString("createValue") val updateKey = "updateKey" @@ -993,7 +992,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "invoke action while not encoding &, <, > characters" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "nonescape" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) val nonescape = "&<>" val input = Map("payload" -> nonescape.toJson) val output = JsObject("payload" -> JsString(s"hello, $nonescape!")) @@ -1014,11 +1013,11 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "get an action URL" in withAssetCleaner(wskprops) { (wp, assetHelper) => - val actionName = WskCliTestHelpers.withTimestamp("action name@_-.") - val packageName = WskCliTestHelpers.withTimestamp("package name@_-.") + val actionName = withTimestamp("action name@_-.") + val packageName = withTimestamp("package name@_-.") val defaultPackageName = "default" - val webActionName = WskCliTestHelpers.withTimestamp("web action name@_-.") - val nonExistentActionName = WskCliTestHelpers.withTimestamp("non-existence action") + val webActionName = withTimestamp("web action name@_-.") + val nonExistentActionName = withTimestamp("non-existence action") val packagedAction = s"$packageName/$actionName" val packagedWebAction = s"$packageName/$webActionName" val namespace = wsk.namespace.whois() @@ -1139,7 +1138,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { val params = Seq("-p", "bigValue", "a" * 1000) assetHelper.withCleaner(wsk.action, name) { (action, _) => - action.create(name, Some(TestCLIUtils.getTestActionFilename("echo.js"))) + action.create(name, Some(TestUtils.getTestActionFilename("echo.js"))) } val truncated = @@ -1382,8 +1381,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "create, and get a package to verify file parameter and annotation parsing" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "packageAnnotAndParamFileParsing" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) - val argInput = Some(TestCLIUtils.getTestActionFilename("validInput1.json")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) + val argInput = Some(TestUtils.getTestActionFilename("validInput1.json")) assetHelper.withCleaner(wsk.pkg, name) { (pkg, _) => pkg.create(name, annotationFile = argInput, parameterFile = argInput) @@ -1444,7 +1443,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "report conformance error accessing action as package" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "aAsP" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, file) } @@ -1567,8 +1566,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "create, and get a trigger to verify file parameter and annotation parsing" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "triggerAnnotAndParamFileParsing" - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) - val argInput = Some(TestCLIUtils.getTestActionFilename("validInput1.json")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) + val argInput = Some(TestUtils.getTestActionFilename("validInput1.json")) assetHelper.withCleaner(wsk.trigger, name) { (trigger, _) => trigger.create(name, annotationFile = argInput, parameterFile = argInput) @@ -1662,12 +1661,12 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "invoke a feed action with the correct lifecyle event when creating, retrieving and deleting a feed trigger" in withAssetCleaner( wskprops) { (wp, assetHelper) => - val actionName = WskCliTestHelpers.withTimestamp("echo") + val actionName = withTimestamp("echo") val triggerName = "feedTest" assetHelper.withCleaner(wsk.action, actionName) { (action, _) => action.create(actionName, - Some(TestCLIUtils.getTestActionFilename("echo.js"))) + Some(TestUtils.getTestActionFilename("echo.js"))) } try { @@ -1771,7 +1770,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "create, and list an action with a long name" in withAssetCleaner( wskprops) { (wp, assetHelper) => val name = "x" * 70 - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) assetHelper.withCleaner(wsk.action, name) { (action, _) => action.create(name, file) } @@ -1794,8 +1793,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "create, and list a rule with a long name" in withAssetCleaner( wskprops) { (wp, assetHelper) => val ruleName = "x" * 70 - val triggerName = WskCliTestHelpers.withTimestamp("listRulesTrigger") - val actionName = WskCliTestHelpers.withTimestamp("listRulesAction"); + val triggerName = withTimestamp("listRulesTrigger") + val actionName = withTimestamp("listRulesAction"); assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, name) => trigger.create(name) } @@ -1813,7 +1812,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "return a list of alphabetized actions" in withAssetCleaner( wskprops) { (wp, assetHelper) => // Declare 4 actions, create them out of alphabetical order - val actionName = WskCliTestHelpers.withTimestamp("actionAlphaTest") + val actionName = withTimestamp("actionAlphaTest") for (i <- 1 to 3) { val name = s"$actionName$i" assetHelper.withCleaner(wsk.action, name) { (action, name) => @@ -1840,8 +1839,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "return an alphabetized list with default package actions on top" in withAssetCleaner( wskprops) { (wp, assetHelper) => // Declare 4 actions, create them out of alphabetical order - val actionName = WskCliTestHelpers.withTimestamp("actionPackageAlphaTest") - val packageName = WskCliTestHelpers.withTimestamp("packageAlphaTest") + val actionName = withTimestamp("actionPackageAlphaTest") + val packageName = withTimestamp("packageAlphaTest") assetHelper.withCleaner(wsk.action, actionName) { (action, actionName) => action.create(actionName, defaultAction) } @@ -1933,8 +1932,8 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "return a list of alphabetized rules" in withAssetCleaner(wskprops) { (wp, assetHelper) => // Declare a trigger and an action for the purposes of creating rules - val triggerName = WskCliTestHelpers.withTimestamp("listRulesTrigger") - val actionName = WskCliTestHelpers.withTimestamp("listRulesAction") + val triggerName = withTimestamp("listRulesTrigger") + val actionName = withTimestamp("listRulesAction") assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, name) => trigger.create(name) @@ -1968,21 +1967,21 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "reject commands that are executed with invalid JSON for annotations and parameters" in { val invalidJSONInputs = getInvalidJSONInput val invalidJSONFiles = Seq( - TestCLIUtils.getTestActionFilename("malformed.js"), - TestCLIUtils.getTestActionFilename("invalidInput1.json"), - TestCLIUtils.getTestActionFilename("invalidInput2.json"), - TestCLIUtils.getTestActionFilename("invalidInput3.json"), - TestCLIUtils.getTestActionFilename("invalidInput4.json") + TestUtils.getTestActionFilename("malformed.js"), + TestUtils.getTestActionFilename("invalidInput1.json"), + TestUtils.getTestActionFilename("invalidInput2.json"), + TestUtils.getTestActionFilename("invalidInput3.json"), + TestUtils.getTestActionFilename("invalidInput4.json") ) val paramCmds = Seq( Seq("action", "create", "actionName", - TestCLIUtils.getTestActionFilename("hello.js")), + TestUtils.getTestActionFilename("hello.js")), Seq("action", "update", "actionName", - TestCLIUtils.getTestActionFilename("hello.js")), + TestUtils.getTestActionFilename("hello.js")), Seq("action", "invoke", "actionName"), Seq("package", "create", "packageName"), Seq("package", "update", "packageName"), @@ -1995,11 +1994,11 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { Seq("action", "create", "actionName", - TestCLIUtils.getTestActionFilename("hello.js")), + TestUtils.getTestActionFilename("hello.js")), Seq("action", "update", "actionName", - TestCLIUtils.getTestActionFilename("hello.js")), + TestUtils.getTestActionFilename("hello.js")), Seq("package", "create", "packageName"), Seq("package", "update", "packageName"), Seq("package", "bind", "packageName", "boundPackageName"), @@ -2042,7 +2041,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { } it should "reject commands that are executed with a missing or invalid parameter or annotation file" in { - val emptyFile = TestCLIUtils.getTestActionFilename("emtpy.js") + val emptyFile = TestUtils.getTestActionFilename("emtpy.js") val missingFile = "notafile" val emptyFileMsg = s"File '$emptyFile' is not a valid file or it does not exist" @@ -2052,14 +2051,14 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { (Seq("action", "create", "actionName", - TestCLIUtils.getTestActionFilename("hello.js"), + TestUtils.getTestActionFilename("hello.js"), "-P", emptyFile), emptyFileMsg), (Seq("action", "update", "actionName", - TestCLIUtils.getTestActionFilename("hello.js"), + TestUtils.getTestActionFilename("hello.js"), "-P", emptyFile), emptyFileMsg), @@ -2094,14 +2093,14 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { (Seq("action", "create", "actionName", - TestCLIUtils.getTestActionFilename("hello.js"), + TestUtils.getTestActionFilename("hello.js"), "-A", missingFile), missingFileMsg), (Seq("action", "update", "actionName", - TestCLIUtils.getTestActionFilename("hello.js"), + TestUtils.getTestActionFilename("hello.js"), "-A", missingFile), missingFileMsg), @@ -2419,7 +2418,7 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers { it should "create an action with different permutations of limits" in withAssetCleaner( wskprops) { (wp, assetHelper) => - val file = Some(TestCLIUtils.getTestActionFilename("hello.js")) + val file = Some(TestUtils.getTestActionFilename("hello.js")) def testLimit(timeout: Option[Duration] = None, memory: Option[ByteSize] = None, -- To stop receiving notification emails like this one, please contact dube...@apache.org.