From 6325bcf5b2ea07d50934a26518dd019a88a7d44d Mon Sep 17 00:00:00 2001 From: "Marcelo E. Magallon" Date: Sat, 17 Oct 2015 12:03:27 -0600 Subject: [PATCH] Add tests for websocket configuration Command arguments: websocket /api5 "cmd arg1 arg2 arg3" Optional block: websocket /api6 cat { respawn } Invalid option in optional block: websocket /api7 cat { invalid } --- config/setup/websocket_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/config/setup/websocket_test.go b/config/setup/websocket_test.go index 750f2a1d8..ae3513602 100644 --- a/config/setup/websocket_test.go +++ b/config/setup/websocket_test.go @@ -54,6 +54,25 @@ func TestWebSocketParse(t *testing.T) { Path: "/api4", Command: "cat", }}}, + + {`websocket /api5 "cmd arg1 arg2 arg3"`, false, []websocket.Config{{ + Path: "/api5", + Command: "cmd", + Arguments: []string{"arg1", "arg2", "arg3"}, + }}}, + + // accept respawn + {`websocket /api6 cat { + respawn + }`, false, []websocket.Config{{ + Path: "/api6", + Command: "cat", + }}}, + + // invalid configuration + {`websocket /api7 cat { + invalid + }`, true, []websocket.Config{}}, } for i, test := range tests { c := NewTestController(test.inputWebSocketConfig)