From 580936e5448102b8f5500d058a4c626693a7a79a Mon Sep 17 00:00:00 2001 From: Belinda Vennam Date: Wed, 27 Jun 2018 14:39:56 -0500 Subject: [PATCH 1/3] update to accept alternate manifest extension --- packages/actions/lib/common.js | 9 ++++++--- .../test/scala/packages/deployWebTests.scala | 15 +++++++++++++++ .../helloWorldAltManifest/actions/helloworld.js | 17 +++++++++++++++++ .../helloWorldAltManifest/manifest.yml | 15 +++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 tests/src/test/scala/testFixtures/helloWorldAltManifest/actions/helloworld.js create mode 100644 tests/src/test/scala/testFixtures/helloWorldAltManifest/manifest.yml diff --git a/packages/actions/lib/common.js b/packages/actions/lib/common.js index a7134f1..dada2f7 100644 --- a/packages/actions/lib/common.js +++ b/packages/actions/lib/common.js @@ -36,10 +36,13 @@ function main(params) { const manifestFilePath = `${repoDir}/${manifestPath}/${manifestFileName}`; if (!fs.existsSync(manifestFilePath)) { - if (usingTemp) { - deleteFolder(repoDir); + const altManifestFilePath = `${repoDir}/${manifestPath}/manifest.yml`; + if (!fs.existsSync(altManifestFilePath)) { + if (usingTemp) { + deleteFolder(repoDir); + } + reject(new Error('Error loading manifest file. Does a manifest file exist?')); } - reject(new Error('Error loading manifest file. Does a manifest file exist?')); } else { exec(command, execOptions, (err, stdout, stderr) => { if (usingTemp) { diff --git a/tests/src/test/scala/packages/deployWebTests.scala b/tests/src/test/scala/packages/deployWebTests.scala index 054aa06..6078905 100644 --- a/tests/src/test/scala/packages/deployWebTests.scala +++ b/tests/src/test/scala/packages/deployWebTests.scala @@ -46,9 +46,11 @@ class DeployWebTests extends TestHelpers val incorrectGithubRepo = "https://github.com/apache/openwhisk-package-deploy-incorrect" val helloWorldPath = "tests/src/test/scala/testFixtures/helloWorld" val helloWorldWithNoManifest = "tests/src/test/scala/testFixtures/helloWorldNoManifest" + val helloWorldAltManifest = "tests/src/test/scala/testFixtures/helloWorldAltManifest" val helloWorldPackageParam = "tests/src/test/scala/testFixtures/helloWorldPackageParam" val incorrectManifestPath = "does/not/exist" val helloWorldAction = "openwhisk-helloworld/helloworld" + val helloWorldAltAction = "openwhisk-helloworld/helloworldAlt" val helloWorldActionPackage = "myPackage/helloworld" // statuses from deployWeb @@ -87,6 +89,19 @@ class DeployWebTests extends TestHelpers wsk.action.delete(helloWorldAction) } + // test to create the hello world template with alternate manifest from github + it should "create the hello world action from github url" in { + makePostCallWithExpectedResult(JsObject( + "gitUrl" -> JsString(deployTestRepo), + "manifestPath" -> JsString(helloWorldAltManifest), + "wskApiHost" -> JsString(wskprops.apihost), + "wskAuth" -> JsString(wskprops.authKey) + ), successStatus, 200); + + // clean up after test + wsk.action.delete(helloWorldAltAction) + } + // test to create the hello world template from github with myPackage as package name it should s"create the $helloWorldActionPackage action from github url" in { makePostCallWithExpectedResult(JsObject( diff --git a/tests/src/test/scala/testFixtures/helloWorldAltManifest/actions/helloworld.js b/tests/src/test/scala/testFixtures/helloWorldAltManifest/actions/helloworld.js new file mode 100644 index 0000000..a34e766 --- /dev/null +++ b/tests/src/test/scala/testFixtures/helloWorldAltManifest/actions/helloworld.js @@ -0,0 +1,17 @@ +/** + * + * main() will be invoked when you Run This Action. + * + * @param Cloud Functions actions accept a single parameter, + * which must be a JSON object. + * + * In this case, the params variable will look like: + * { "message": "xxxx" } + * + * @return which must be a JSON object. + * It will be the output of this action. + * + */ +function main(params) { + return { "message": "you sent me " + params.message }; +} diff --git a/tests/src/test/scala/testFixtures/helloWorldAltManifest/manifest.yml b/tests/src/test/scala/testFixtures/helloWorldAltManifest/manifest.yml new file mode 100644 index 0000000..0831261 --- /dev/null +++ b/tests/src/test/scala/testFixtures/helloWorldAltManifest/manifest.yml @@ -0,0 +1,15 @@ +# Wskdeploy manifest for hello-world + +# Deployment using this manifest file creates the following OpenWhisk components: +# Package: openwhisk-helloworld +# Action: openwhisk-helloworld/helloworld.js + +project: + namespace: _ + packages: + openwhisk-helloworld: + version: 1.0 + license: Apache-2.0 + actions: + helloworldAlt: + function: actions/helloworld.js From 92de07121aaa237992e0b77aac48fba47919736c Mon Sep 17 00:00:00 2001 From: Belinda Vennam Date: Wed, 27 Jun 2018 15:15:24 -0500 Subject: [PATCH 2/3] update build.sh --- tools/travis/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/travis/build.sh b/tools/travis/build.sh index 7626625..907df9d 100755 --- a/tools/travis/build.sh +++ b/tools/travis/build.sh @@ -29,6 +29,7 @@ $ANSIBLE_CMD initdb.yml cd $WHISKDIR TERM=dumb ./gradlew \ +:tools:admin:install \ :common:scala:install \ :core:controller:install \ :core:invoker:install \ From 58d5430131b26aaafe294b65acb418360947c3e6 Mon Sep 17 00:00:00 2001 From: Belinda Vennam Date: Wed, 27 Jun 2018 16:31:54 -0500 Subject: [PATCH 3/3] update test name --- tests/src/test/scala/packages/deployWebTests.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/test/scala/packages/deployWebTests.scala b/tests/src/test/scala/packages/deployWebTests.scala index 6078905..a11b811 100644 --- a/tests/src/test/scala/packages/deployWebTests.scala +++ b/tests/src/test/scala/packages/deployWebTests.scala @@ -90,7 +90,7 @@ class DeployWebTests extends TestHelpers } // test to create the hello world template with alternate manifest from github - it should "create the hello world action from github url" in { + it should "create the hello world action with alternate manifest extension from github url" in { makePostCallWithExpectedResult(JsObject( "gitUrl" -> JsString(deployTestRepo), "manifestPath" -> JsString(helloWorldAltManifest),