openwhisk-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-openwhisk-devtools] mrutkows commented on a change in pull request #247: updating starter kit
Date Mon, 15 Apr 2019 14:56:43 GMT
mrutkows commented on a change in pull request #247: updating starter kit
URL: https://github.com/apache/incubator-openwhisk-devtools/pull/247#discussion_r275402391
 
 

 ##########
 File path: actionloop-starter-kit/tests/src/test/scala/runtime/actionContainers/SingleTest.scala
 ##########
 @@ -0,0 +1,40 @@
+package runtime.actionContainers
+
+
+import actionContainers.ActionContainer.withContainer
+import actionContainers.{ActionContainer, ActionProxyContainerTestUtils}
+import common.WskActorSystem
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import spray.json.{JsonParser}
+
+@RunWith(classOf[JUnitRunner])
+class SingleTest extends ActionProxyContainerTestUtils with WskActorSystem {
+  lazy val imageName = "actionloop-demo-python-v3.7"
+
+  def withActionContainer(env: Map[String, String] = Map.empty)(code: ActionContainer =>
Unit) = {
+    withContainer(imageName, env)(code)
+  }
+
+  behavior of imageName
+
+  val code = 
+    """|import sys
+       |def main(args):
+       |   print("hello stdout", file=sys.stdout)
+       |   print("hello stderr", file=sys.stderr)
+       |   return args
+       |""".stripMargin
+
+
+  val data = JsonParser("""{"name":"Mike"}""")
+ 
+  it should "return an echo of the input" in {
+    val (out, err) = withActionContainer() { c =>
+      val (initCode, _) = c.init(initPayload(code))
+      initCode should be(200)
+      val (runCode, runRes) = c.run(runPayload(data))
+      runCode should be(200)
+    }
+  }
+}
 
 Review comment:
   Please fix Travis EOL scancode break.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

Mime
View raw message