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..a11b811 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 with alternate manifest extension 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 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 \