This is an automated email from the ASF dual-hosted git repository.

dubeejw 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 9241001  Ensure clean up testspace under wskadmin test. (#3474)
9241001 is described below

commit 92410010d3582d6757827b21adfef334b6ea8020
Author: Tzu-Chiao Yeh <[email protected]>
AuthorDate: Thu Mar 22 03:13:05 2018 +0800

    Ensure clean up testspace under wskadmin test. (#3474)
    
    Fix up testsuite `block and unblock a user respectively` fails when
    `testspace` contains pre-existing users.
    
    Signed-off-by: Tzu-Chiao Yeh <[email protected]>
---
 .../test/scala/whisk/core/admin/WskAdminTests.scala  | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tests/src/test/scala/whisk/core/admin/WskAdminTests.scala 
b/tests/src/test/scala/whisk/core/admin/WskAdminTests.scala
index 58b1def..3b5874f 100644
--- a/tests/src/test/scala/whisk/core/admin/WskAdminTests.scala
+++ b/tests/src/test/scala/whisk/core/admin/WskAdminTests.scala
@@ -22,6 +22,7 @@ import scala.concurrent.duration.DurationInt
 import org.junit.runner.RunWith
 import org.scalatest.Matchers
 import org.scalatest.junit.JUnitRunner
+import org.scalatest.BeforeAndAfterAll
 
 import common.RunWskAdminCmd
 import common.TestHelpers
@@ -31,9 +32,26 @@ import common.WskProps
 import whisk.core.entity.AuthKey
 import whisk.core.entity.Subject
 import common.TestUtils
+import scala.util.Try
 
 @RunWith(classOf[JUnitRunner])
-class WskAdminTests extends TestHelpers with Matchers {
+class WskAdminTests extends TestHelpers with Matchers with BeforeAndAfterAll {
+
+  override def beforeAll() = {
+    val wskadmin = new RunWskAdminCmd {}
+    val testSpaces = Seq("testspace", "testspace1", "testspace2")
+    testSpaces.foreach(testspace => {
+      Try {
+        val identities = wskadmin.cli(Seq("user", "list", "-a", testspace))
+        identities.stdout
+          .split("\n")
+          .foreach(ident => {
+            val sub = ident.split("\\s+").last
+            wskadmin.cli(Seq("user", "delete", sub, "-ns", testspace))
+          })
+      }
+    })
+  }
 
   behavior of "Wsk Admin CLI"
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to