You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/02/16 21:40:52 UTC

[GitHub] csantanapr closed pull request #15: Return activationID

csantanapr closed pull request #15: Return activationID
URL: https://github.com/apache/incubator-openwhisk-package-deploy/pull/15
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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)
     }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services