openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markusthoem...@apache.org
Subject [incubator-openwhisk] branch master updated: Ping test should check for absence of ping response. (#4015)
Date Wed, 12 Sep 2018 12:16:55 GMT
This is an automated email from the ASF dual-hosted git repository.

markusthoemmes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 2fa7196  Ping test should check for absence of ping response. (#4015)
2fa7196 is described below

commit 2fa71962aa2105f13c149d7e07b6770cb937abe3
Author: Chetan Mehrotra <chetanm@apache.org>
AuthorDate: Wed Sep 12 17:46:47 2018 +0530

    Ping test should check for absence of ping response. (#4015)
---
 tests/dat/actions/ping.js                              | 6 ++++--
 tests/src/test/scala/system/basic/WskActionTests.scala | 9 +++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/dat/actions/ping.js b/tests/dat/actions/ping.js
index 2ac1649..8100e83 100644
--- a/tests/dat/actions/ping.js
+++ b/tests/dat/actions/ping.js
@@ -9,7 +9,7 @@ function main(msg) {
     var promise = new Promise(function(resolve, reject) {
         var child = spawn('ping -c 3 ' + hostToPing);
 
-        var tmp = {stdout: "", stderr: ""};
+        var tmp = {stdout: "", stderr: "", code: 0};
 
         child.stdout.on('data', function (data) {
             tmp.stdout = tmp.stdout + data;
@@ -19,7 +19,9 @@ function main(msg) {
             tmp.stderr = tmp.stderr + data;
         });
 
-        child.on('close', function () {
+        child.on('close', function (code) {
+            tmp.code = code;
+            console.log('code', tmp.code);
             console.log('stdout', tmp.stdout);
             console.log('stderr', tmp.stderr);
             resolve(tmp);
diff --git a/tests/src/test/scala/system/basic/WskActionTests.scala b/tests/src/test/scala/system/basic/WskActionTests.scala
index 47b7d39..a003a87 100644
--- a/tests/src/test/scala/system/basic/WskActionTests.scala
+++ b/tests/src/test/scala/system/basic/WskActionTests.scala
@@ -266,8 +266,13 @@ class WskActionTests extends TestHelpers with WskTestHelpers with JsHelpers
with
 
     val run = wsk.action.invoke(name, Map("payload" -> "google.com".toJson))
     withActivation(wsk.activation, run) { activation =>
-      activation.response.result shouldBe Some(
-        JsObject("stderr" -> "ping: icmp open socket: Operation not permitted\n".toJson,
"stdout" -> "".toJson))
+      val result = activation.response.result.get
+      result.getFields("stdout", "code") match {
+        case Seq(JsString(stdout), JsNumber(code)) =>
+          stdout should not include "bytes from"
+          code.intValue() should not be 0
+        case _ => fail(s"fields 'stdout' or 'code' where not of the expected format, was
$result")
+      }
     }
   }
 


Mime
View raw message