openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dube...@apache.org
Subject [incubator-openwhisk] branch master updated: optionally prohibit test cases using --auth to override the namespace target (#4153)
Date Tue, 04 Dec 2018 15:20:28 GMT
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 2bf2ace  optionally prohibit test cases using --auth to override the namespace target
(#4153)
2bf2ace is described below

commit 2bf2ace9636d7c84a23d7764aa5379c1f4b9015e
Author: Mark Deuser <mdeuser@us.ibm.com>
AuthorDate: Tue Dec 4 10:20:22 2018 -0500

    optionally prohibit test cases using --auth to override the namespace target (#4153)
---
 tests/src/test/scala/common/RunCliCmd.scala | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/src/test/scala/common/RunCliCmd.scala b/tests/src/test/scala/common/RunCliCmd.scala
index e3e7e44..67a4264 100644
--- a/tests/src/test/scala/common/RunCliCmd.scala
+++ b/tests/src/test/scala/common/RunCliCmd.scala
@@ -33,6 +33,8 @@ trait RunCliCmd extends Matchers {
    */
   def baseCommand: Buffer[String]
 
+  val prohibitAuthOverride = false
+
   /**
    * Delegates execution of the command to an underlying implementation.
    *
@@ -69,14 +71,18 @@ trait RunCliCmd extends Matchers {
 
     val args = baseCommand
     if (verbose) args += "--verbose"
-    if (showCmd) println(args.mkString(" ") + " " + params.mkString(" "))
+    val finalParams = if (!prohibitAuthOverride) { params } else {
+      params.filter(s =>
+        !s.equals("--auth") && !(params.indexOf(s) > 0 && params(params.indexOf(s)
- 1).equals("--auth")))
+    }
+    if (showCmd) println(args.mkString(" ") + " " + finalParams.mkString(" "))
 
     val rr = retry(
       0,
       retriesOnNetworkError,
-      () => runCmd(DONTCARE_EXIT, workingDir, sys.env ++ env, stdinFile, args ++ params))
+      () => runCmd(DONTCARE_EXIT, workingDir, sys.env ++ env, stdinFile, args ++ finalParams))
 
-    withClue(hideStr(reportFailure(args ++ params, expectedExitCode, rr).toString(), hideFromOutput))
{
+    withClue(hideStr(reportFailure(args ++ finalParams, expectedExitCode, rr).toString(),
hideFromOutput)) {
       if (expectedExitCode != TestUtils.DONTCARE_EXIT) {
         val ok = (rr.exitCode == expectedExitCode) || (expectedExitCode == TestUtils.ANY_ERROR_EXIT
&& rr.exitCode != 0)
         if (!ok) {


Mime
View raw message