You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2018/02/16 21:40:50 UTC
[incubator-openwhisk-package-deploy] branch master updated: Return
activationID (#15)
This is an automated email from the ASF dual-hosted git repository.
csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-deploy.git
The following commit(s) were added to refs/heads/master by this push:
new c3fd9dc Return activationID (#15)
c3fd9dc is described below
commit c3fd9dce92d82868edfc4eb0f72584fd8e865546
Author: Belinda Vennam <be...@gmail.com>
AuthorDate: Fri Feb 16 15:40:48 2018 -0600
Return activationID (#15)
---
packages/actions/deployWeb.js | 14 ++++++++------
tests/src/test/scala/packages/deployWebTests.scala | 14 ++++++++------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/packages/actions/deployWeb.js b/packages/actions/deployWeb.js
index 2639496..4865549 100644
--- a/packages/actions/deployWeb.js
+++ b/packages/actions/deployWeb.js
@@ -15,6 +15,7 @@ let command = '';
* @return {object} Promise
*/
function main(params) {
+ const activationId = process.env.__OW_ACTIVATION_ID;
// Grab optional envData and manifestPath params for wskdeploy
let {
envData,
@@ -80,7 +81,7 @@ function main(params) {
resolve({
statusCode: 200,
headers: {'Content-Type': 'application/json'},
- body: new Buffer(JSON.stringify({'status': 'success'})).toString('base64')
+ body: new Buffer(JSON.stringify({status: success, activationId: activationId })).toString('base64')
});
});
})
@@ -118,14 +119,15 @@ function getWskApiAuth(params) {
}
function sendError(statusCode, error, message) {
- var params = {error: error};
+ const activationId = process.env.__OW_ACTIVATION_ID;
+ const params = { error, activationId };
if (message) {
- params.message = message;
+ params.message = message;
}
return {
- statusCode: statusCode,
- headers: { 'Content-Type': 'application/json' },
- body: new Buffer(JSON.stringify(params)).toString('base64')
+ statusCode: statusCode,
+ headers: { 'Content-Type': 'application/json' },
+ body: new Buffer(JSON.stringify(params)).toString('base64')
};
}
diff --git a/tests/src/test/scala/packages/deployWebTests.scala b/tests/src/test/scala/packages/deployWebTests.scala
index d917f65..054aa06 100644
--- a/tests/src/test/scala/packages/deployWebTests.scala
+++ b/tests/src/test/scala/packages/deployWebTests.scala
@@ -52,8 +52,9 @@ class DeployWebTests extends TestHelpers
val helloWorldActionPackage = "myPackage/helloworld"
// statuses from deployWeb
- val successStatus = """{"status":"success"}"""
- val githubNonExistentStatus = """{"error":"There was a problem cloning from github. Does that github repo exist? Does it begin with http?"}"""
+ val successStatus = """"status":"success""""
+ val activationId = """"activationId:""""
+ val githubNonExistentStatus = """"error":"There was a problem cloning from github. Does that github repo exist? Does it begin with http?""""
def makePostCallWithExpectedResult(params: JsObject, expectedResult: String, expectedCode: Int) = {
val response = RestAssured.given()
@@ -62,7 +63,8 @@ class DeployWebTests extends TestHelpers
.body(params.toString())
.post(deployActionURL)
assert(response.statusCode() == expectedCode)
- response.body.asString shouldBe expectedResult
+ response.body.asString should include(expectedResult)
+ response.body.asString.parseJson.asJsObject.getFields("activationId") should have length 1
}
behavior of "deployWeb Package"
@@ -105,7 +107,7 @@ class DeployWebTests extends TestHelpers
"manifestPath" -> JsString(helloWorldPath),
"wskApiHost" -> JsString(wskprops.apihost),
"wskAuth" -> JsString(wskprops.authKey)
- ), """{"error":"Please enter the GitHub repo url in params"}""", 400)
+ ), """"error":"Please enter the GitHub repo url in params"""", 400)
}
// test to create a template with a nonexistant github repo provided
@@ -139,7 +141,7 @@ class DeployWebTests extends TestHelpers
"manifestPath" -> JsString(incorrectManifestPath),
"wskApiHost" -> JsString(wskprops.apihost),
"wskAuth" -> JsString(wskprops.authKey)
- ), """{"error":"Error loading manifest file. Does a manifest file exist?"}""", 400)
+ ), """"error":"Error loading manifest file. Does a manifest file exist?"""", 400)
}
// test to create a template with manifestPath provided, but no manifestFile existing
@@ -149,6 +151,6 @@ class DeployWebTests extends TestHelpers
"manifestPath" -> JsString(helloWorldWithNoManifest),
"wskApiHost" -> JsString(wskprops.apihost),
"wskAuth" -> JsString(wskprops.authKey)
- ), """{"error":"Error loading manifest file. Does a manifest file exist?"}""", 400)
+ ), """"error":"Error loading manifest file. Does a manifest file exist?"""", 400)
}
}
--
To stop receiving notification emails like this one, please contact
csantanapr@apache.org.