This is an automated email from the ASF dual-hosted git repository.
japetrsn pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-openwhisk-catalog.git
The following commit(s) were added to refs/heads/master by this push:
new ab57787 Use websocket.org for WebSocket tests (#276)
ab57787 is described below
commit ab5778751df0961a73751e2e15fbbcb2f08655d1
Author: James Dubee <[email protected]>
AuthorDate: Tue May 15 12:34:22 2018 -0400
Use websocket.org for WebSocket tests (#276)
* Use websocket.org for WebSocket tests
---
.../scala/packages/websocket/WebSocketTests.scala | 73 +---------------------
1 file changed, 1 insertion(+), 72 deletions(-)
diff --git a/tests/src/test/scala/packages/websocket/WebSocketTests.scala
b/tests/src/test/scala/packages/websocket/WebSocketTests.scala
index 54353eb..c870c1b 100644
--- a/tests/src/test/scala/packages/websocket/WebSocketTests.scala
+++ b/tests/src/test/scala/packages/websocket/WebSocketTests.scala
@@ -17,7 +17,6 @@
package packages.websocket
-import java.io.File
import java.net.URI
import scala.concurrent.duration.DurationInt
@@ -37,18 +36,12 @@ class WebSocketTests extends TestHelpers with
WskTestHelpers with BeforeAndAfter
val websocketSendAction = "/whisk.system/websocket/send"
- val containerName = "websocketServerOW"
- val userDir: String = System.getProperty("user.dir")
- val websocketDir: String = userDir + "/dat/websocket"
- val websocketHost: String = wskprops.apihost
- val websocketPort = "20002"
-
behavior of "Websocket action"
/**
* This test requires a websocket server running on the given URI.
*/
- val serverURI: URI = new URI(s"ws://$websocketHost:$websocketPort")
+ val serverURI: URI = new URI("ws://echo.websocket.org")
it should "Use the websocket action to send a payload" in {
val uniquePayload = s"The cow says ${System.currentTimeMillis()}".toJson
@@ -90,68 +83,4 @@ class WebSocketTests extends TestHelpers with WskTestHelpers
with BeforeAndAfter
}
}
- override def beforeAll() {
-
- val websocketServer =
- """
- | const WebSocket = require("ws");
- | const wss = new WebSocket.Server({ port: 8080 });
- | wss.on("connection", function connection(ws) {
- | ws.on("message", function incoming(message) {
- | ws.send(message);
- | });
- | });
- """.replace("\r", "").stripMargin.lines.mkString
- TestUtils.runCmd(TestUtils.DONTCARE_EXIT, new File("."), "docker", "kill",
containerName)
- TestUtils.runCmd(TestUtils.DONTCARE_EXIT, new File("."), "docker", "rm",
containerName)
- TestUtils.runCmd(
- 0,
- new File("."),
- "docker",
- "run",
- "-d",
- "-p",
- "20002:8080",
- "--name",
- containerName,
- "node",
- "sh",
- "-c",
- s"npm install ws; echo '$websocketServer' | node")
- sleepUntilContainerRunning()
-
- }
-
- def sleepUntilContainerRunning() {
- var counter = 12
- var running = false
- do {
- counter = counter - 1
- val isdb2Running = TestUtils
- .runCmd(
- TestUtils.DONTCARE_EXIT,
- new File("."),
- "docker",
- "exec",
- "-t",
- containerName,
- "curl",
- "http://localhost:8080",
- "--connect-timeout",
- "5")
-
- if (isdb2Running.exitCode != 0) {
- println("sleeping 5 seconds to wait for websocket server")
- Thread.sleep(5000)
- } else {
- running = true
- }
- } while (counter > 0 && !running)
- running shouldBe true
- }
-
- override def afterAll() {
- TestUtils.runCmd(TestUtils.DONTCARE_EXIT, new File("."), "docker", "kill",
containerName)
- TestUtils.runCmd(TestUtils.DONTCARE_EXIT, new File("."), "docker", "rm",
containerName)
- }
}
--
To stop receiving notification emails like this one, please contact
[email protected].