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-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new a6bfa01  Change to ensure we can't pass in both --kind and --docker at 
the same time.  It should produce an error.
a6bfa01 is described below

commit a6bfa01f7a985e1e540391df55428a35de8084c9
Author: Jesus G. Alva <ja...@us.ibm.com>
AuthorDate: Wed Nov 29 14:49:15 2017 -0600

    Change to ensure we can't pass in both --kind and --docker at the same 
time.  It should produce an error.
---
 commands/action.go                                     |  5 +++++
 tests/src/test/scala/system/basic/WskActionTests.scala | 15 +++++++++++++++
 wski18n/resources/en_US.all.json                       |  4 ++++
 3 files changed, 24 insertions(+)

diff --git a/commands/action.go b/commands/action.go
index 75aa7c5..df75ffd 100644
--- a/commands/action.go
+++ b/commands/action.go
@@ -398,6 +398,11 @@ func parseAction(cmd *cobra.Command, args []string, update 
bool) (*whisk.Action,
         action.Annotations = annotations.(whisk.KeyValueArr)
     }
 
+    if len(Flags.action.kind) > 0 && len(Flags.action.docker) > 0 {
+        errStr := wski18n.T("Cannot specify both --kind and --docker at the 
same time.")
+        return nil, whisk.MakeWskError(errors.New(errStr), whisk.NOT_ALLOWED, 
whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
+    }
+
     if Flags.action.copy {
         var copiedQualifiedName = new(QualifiedName)
 
diff --git a/tests/src/test/scala/system/basic/WskActionTests.scala 
b/tests/src/test/scala/system/basic/WskActionTests.scala
index b6d3513..3fa080d 100644
--- a/tests/src/test/scala/system/basic/WskActionTests.scala
+++ b/tests/src/test/scala/system/basic/WskActionTests.scala
@@ -24,6 +24,7 @@ import common.ActivationResult
 import common.JsHelpers
 import common.TestHelpers
 import common.TestCLIUtils
+import common.TestUtils._
 import common.BaseWsk
 import common.Wsk
 import common.WskProps
@@ -295,4 +296,18 @@ abstract class WskActionTests extends TestHelpers with 
WskTestHelpers with JsHel
       activation.logs.get.mkString(" ") should include(s"hello $utf8")
     }
   }
+
+  it should "not be able to use --kind and --docker at the same time when 
running action create" in {
+    val file = TestCLIUtils.getTestActionFilename(s"echo.js")
+    val out = wsk.action.create(name = "kindAndDockerAction", artifact = 
Some(file), expectedExitCode = NOT_ALLOWED,
+        kind = Some("nodejs:6"), docker = Some("mydockerimagename"))
+    out.stderr should include("Cannot specify both --kind and --docker at the 
same time")
+  }
+
+  it should "not be able to use --kind and --docker at the same time when 
running action update" in {
+    val file = TestCLIUtils.getTestActionFilename(s"echo.js")
+    val out = wsk.action.create(name = "kindAndDockerAction", artifact = 
Some(file), expectedExitCode = NOT_ALLOWED,
+      kind = Some("nodejs:6"), docker = Some("mydockerimagename"), update = 
true)
+    out.stderr should include("Cannot specify both --kind and --docker at the 
same time")
+  }
 }
diff --git a/wski18n/resources/en_US.all.json b/wski18n/resources/en_US.all.json
index acc6e2c..0777312 100644
--- a/wski18n/resources/en_US.all.json
+++ b/wski18n/resources/en_US.all.json
@@ -1554,5 +1554,9 @@
   {
     "id": "Cannot create file '{{.name}}': {{.err}}",
     "translation": "Cannot create file '{{.name}}': {{.err}}"
+  },
+  {
+    "id": "Cannot specify both --kind and --docker at the same time.",
+    "translation": "Cannot specify both --kind and --docker at the same time."
   }
 ]

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

Reply via email to