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/05/22 07:58:19 UTC

[GitHub] markusthoemmes closed pull request #3672: Add retries in test around package list and enhance debugging inform…

markusthoemmes closed pull request #3672: Add retries in test around package list and enhance debugging inform…
URL: https://github.com/apache/incubator-openwhisk/pull/3672
 
 
   

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/tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala
index 8a1e5121f1..e2d32a79f7 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala
@@ -31,7 +31,6 @@ import spray.json._
 import spray.json.DefaultJsonProtocol._
 import whisk.core.entity.Subject
 import whisk.core.entity.WhiskPackage
-import whisk.utils.retry
 import scala.concurrent.duration._
 
 @RunWith(classOf[JUnitRunner])
@@ -48,6 +47,8 @@ abstract class WskEntitlementTests extends TestHelpers with WskTestHelpers with
     disposeAdditionalTestSubject(guestWskProps.namespace)
   }
 
+  def retry[A](block: => A) = whisk.utils.retry(block, 10, Some(500.milliseconds))
+
   val samplePackage = "samplePackage"
   val sampleAction = "sampleAction"
   val fullSampleActionName = s"$samplePackage/$sampleAction"
@@ -153,13 +154,16 @@ abstract class WskEntitlementTests extends TestHelpers with WskTestHelpers with
       pkg.create(samplePackage, shared = Some(true))(wp)
     }
 
-    val packageList = wsk.pkg.list(Some(s"/$guestNamespace"))(defaultWskProps)
-    verifyPackageSharedList(packageList, guestNamespace, samplePackage)
+    retry {
+      val packageList = wsk.pkg.list(Some(s"/$guestNamespace"))(defaultWskProps)
+      verifyPackageSharedList(packageList, guestNamespace, samplePackage)
+    }
   }
 
   def verifyPackageSharedList(packageList: RunResult, namespace: String, packageName: String): Unit = {
     val fullyQualifiedPackageName = s"/$namespace/$packageName"
-    packageList.stdout should include regex (fullyQualifiedPackageName + """\s+shared""")
+    withClue(s"Packagelist is: ${packageList.stdout}; Packagename is: $fullyQualifiedPackageName")(
+      packageList.stdout should include regex (fullyQualifiedPackageName + """\s+shared"""))
   }
 
   it should "not list private packages" in withAssetCleaner(guestWskProps) { (wp, assetHelper) =>
@@ -167,13 +171,16 @@ abstract class WskEntitlementTests extends TestHelpers with WskTestHelpers with
       pkg.create(samplePackage)(wp)
     }
 
-    val packageList = wsk.pkg.list(Some(s"/$guestNamespace"))(defaultWskProps)
-    verifyPackageNotSharedList(packageList, guestNamespace, samplePackage)
+    retry {
+      val packageList = wsk.pkg.list(Some(s"/$guestNamespace"))(defaultWskProps)
+      verifyPackageNotSharedList(packageList, guestNamespace, samplePackage)
+    }
   }
 
   def verifyPackageNotSharedList(packageList: RunResult, namespace: String, packageName: String): Unit = {
     val fullyQualifiedPackageName = s"/$namespace/$packageName"
-    packageList.stdout should not include (fullyQualifiedPackageName)
+    withClue(s"Packagelist is: ${packageList.stdout}; Packagename is: $fullyQualifiedPackageName")(
+      packageList.stdout should not include (fullyQualifiedPackageName))
   }
 
   it should "list shared package actions" in withAssetCleaner(guestWskProps) { (wp, assetHelper) =>
@@ -188,8 +195,10 @@ abstract class WskEntitlementTests extends TestHelpers with WskTestHelpers with
     }
 
     val fullyQualifiedPackageName = s"/$guestNamespace/$samplePackage"
-    val packageList = wsk.action.list(Some(fullyQualifiedPackageName))(defaultWskProps)
-    verifyPackageList(packageList, guestNamespace, samplePackage, sampleAction)
+    retry {
+      val packageList = wsk.action.list(Some(fullyQualifiedPackageName))(defaultWskProps)
+      verifyPackageList(packageList, guestNamespace, samplePackage, sampleAction)
+    }
   }
 
   def verifyPackageList(packageList: RunResult, namespace: String, packageName: String, actionName: String): Unit = {
@@ -369,7 +378,7 @@ abstract class WskEntitlementTests extends TestHelpers with WskTestHelpers with
           trigger.create(name, feed = Some(fullyQualifiedFeedName), expectedExitCode = timeoutCode)(wp)
         }
         // with several active controllers race condition with cache invalidation might occur, thus retry
-        retry(wsk.trigger.get("badfeed", expectedExitCode = notFoundCode)(wp), 10, Some(500.milliseconds))
+        retry(wsk.trigger.get("badfeed", expectedExitCode = notFoundCode)(wp))
       }
   }
 


 

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