openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantan...@apache.org
Subject [incubator-openwhisk-package-alarms] branch master updated: fix test failures (#98)
Date Thu, 21 Sep 2017 16:30:51 GMT
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-alarms.git


The following commit(s) were added to refs/heads/master by this push:
     new b1f04a7  fix test failures (#98)
b1f04a7 is described below

commit b1f04a7b819649e6fd0921202e758599883a4139
Author: Jason Peterson <jasonpet@us.ibm.com>
AuthorDate: Thu Sep 21 12:30:49 2017 -0400

    fix test failures (#98)
---
 .../system/packages/AlarmsMultiWorkersTests.scala  | 47 +++++++++++-----------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/tests/src/test/scala/system/packages/AlarmsMultiWorkersTests.scala b/tests/src/test/scala/system/packages/AlarmsMultiWorkersTests.scala
index ebdcfb8..210b60b 100644
--- a/tests/src/test/scala/system/packages/AlarmsMultiWorkersTests.scala
+++ b/tests/src/test/scala/system/packages/AlarmsMultiWorkersTests.scala
@@ -19,6 +19,7 @@ package system.packages
 import com.jayway.restassured.RestAssured
 import com.jayway.restassured.config.SSLConfig
 import com.jayway.restassured.http.ContentType
+import common.TestUtils.DONTCARE_EXIT
 import common._
 import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
@@ -49,35 +50,35 @@ class AlarmsMultiWorkersTests extends FlatSpec
 
     behavior of "Alarms multi workers feed tests"
 
-    it should "create triggers assigned to worker0 and worker1" in withAssetCleaner(WskProps())
{
+    it should "create triggers assigned to worker10 and worker11" in withAssetCleaner(WskProps())
{
         (wp, assetHelper) =>
             implicit val wskprops = wp // shadow global props and make implicit
 
-            val worker0Trigger = s"dummyAlarmsTrigger-${System.currentTimeMillis}"
-            val worker0Params = JsObject(
-                "triggerName" -> JsString(worker0Trigger),
+            val worker10Trigger = s"worker10AlarmsTrigger-${System.currentTimeMillis}"
+            val worker10Params = JsObject(
+                "triggerName" -> JsString(worker10Trigger),
                 "authKey" -> JsString(s"$user:$password"),
                 "cron" -> "* * * * *".toJson,
-                "workers" -> JsArray(JsString("worker0")))
+                "workers" -> JsArray(JsString("worker10")))
 
-            val worker1Trigger = s"dummyAlarmsTrigger-${System.currentTimeMillis}"
-            val worker1Params = JsObject(
-                "triggerName" -> JsString(worker1Trigger),
+            val worker11Trigger = s"worker11AlarmsTrigger-${System.currentTimeMillis}"
+            val worker11Params = JsObject(
+                "triggerName" -> JsString(worker11Trigger),
                 "authKey" -> JsString(s"$user:$password"),
                 "cron" -> "* * * * *".toJson,
-                "workers" -> JsArray(JsString("worker0"), JsString("worker1")))
+                "workers" -> JsArray(JsString("worker10"), JsString("worker11")))
 
             try {
-                wsk.trigger.create(worker0Trigger)
+                wsk.trigger.create(worker10Trigger)
 
-                //create trigger feed and assign to worker0
-                makePutCallWithExpectedResult(worker0Params, 200)
+                //create trigger feed and assign to worker10
+                makePutCallWithExpectedResult(worker10Params, 200)
 
-                wsk.trigger.create(worker1Trigger)
+                wsk.trigger.create(worker11Trigger)
 
-                //create trigger feed and assign to worker0 or worker1
+                //create trigger feed and assign to worker10 or worker11
                 //the one with the least assigned triggers will be chosen
-                makePutCallWithExpectedResult(worker1Params, 200)
+                makePutCallWithExpectedResult(worker11Params, 200)
 
                 val dbName = s"${dbPrefix}alarmservice"
                 val documents = getAllDocs(dbName)
@@ -85,16 +86,16 @@ class AlarmsMultiWorkersTests extends FlatSpec
                 val worker1Doc = documents
                         .fields("rows")
                         .convertTo[List[JsObject]]
-                        .filter(_.fields("id").convertTo[String].equals(s"$user:$password/_/$worker1Trigger"))
+                        .filter(_.fields("id").convertTo[String].equals(s"$user:$password/_/$worker11Trigger"))
 
-                JsHelpers.getFieldPath(worker1Doc(0), "doc", "worker") shouldBe Some(JsString("worker1"))
+                JsHelpers.getFieldPath(worker1Doc(0), "doc", "worker") shouldBe Some(JsString("worker11"))
             } finally {
-                //delete triggers
-                wsk.trigger.delete(worker0Trigger)
-                wsk.trigger.delete(worker1Trigger)
+                //delete trigger feeds and triggers
+                makeDeleteCallWithExpectedResult(worker10Params, DONTCARE_EXIT)
+                makeDeleteCallWithExpectedResult(worker11Params, DONTCARE_EXIT)
 
-                makeDeleteCallWithExpectedResult(worker0Params, 200)
-                makeDeleteCallWithExpectedResult(worker1Params, 200)
+                wsk.trigger.delete(worker10Trigger, expectedExitCode = DONTCARE_EXIT)
+                wsk.trigger.delete(worker11Trigger, expectedExitCode = DONTCARE_EXIT)
             }
     }
 
@@ -113,7 +114,7 @@ class AlarmsMultiWorkersTests extends FlatSpec
                 .config(RestAssured.config().sslConfig(new SSLConfig().relaxedHTTPSValidation()))
                 .body(params.toString())
                 .delete(webActionURL)
-        assert(response.statusCode() == expectedCode)
+        assert(expectedCode == DONTCARE_EXIT || response.statusCode() == expectedCode)
     }
 
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Mime
View raw message