diff options
author | Loïc Hoguin <[email protected]> | 2018-11-20 13:23:59 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-20 13:23:59 +0100 |
commit | 7b5da290199fa0d668b8d9d8267e188b66da1eb3 (patch) | |
tree | 8653d5d5e646504829c8351e962572b2c3e59777 /test/ws_SUITE.erl | |
parent | 386df43ea4e0ffb8edf652ae65810957f953a9de (diff) | |
download | cowboy-7b5da290199fa0d668b8d9d8267e188b66da1eb3.tar.gz cowboy-7b5da290199fa0d668b8d9d8267e188b66da1eb3.tar.bz2 cowboy-7b5da290199fa0d668b8d9d8267e188b66da1eb3.zip |
Don't run long test suites by default
The examples test suite is only useful once in a while
in order to know whether examples were broken, for example
before issuing a release.
The new ws_autobahn test suite isolates the autobahn test
suite so that it can be ignored by default. It's only
useful to run it when working on the Websocket code or
before issuing a release.
Diffstat (limited to 'test/ws_SUITE.erl')
-rw-r--r-- | test/ws_SUITE.erl | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index af1be05..4e35ec7 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -22,29 +22,12 @@ %% ct. all() -> - [{group, ws}, {group, autobahn}]. + [{group, ws}]. groups() -> - BaseTests = ct_helper:all(?MODULE) -- [autobahn_fuzzingclient], - [{autobahn, [], [autobahn_fuzzingclient]}, {ws, [parallel], BaseTests}]. - -init_per_group(Name = autobahn, Config) -> - %% Some systems have it named pip2. - Out = os:cmd("pip show autobahntestsuite ; pip2 show autobahntestsuite"), - case string:str(Out, "autobahntestsuite") of - 0 -> - ct:print("Skipping the autobahn group because the " - "Autobahn Test Suite is not installed.~nTo install it, " - "please follow the instructions on this page:~n~n " - "http://autobahn.ws/testsuite/installation.html"), - {skip, "Autobahn Test Suite not installed."}; - _ -> - {ok, _} = cowboy:start_clear(Name, [{port, 33080}], #{ - env => #{dispatch => init_dispatch()} - }), - Config - end; -init_per_group(Name = ws, Config) -> + [{ws, [parallel], ct_helper:all(?MODULE)}]. + +init_per_group(Name, Config) -> cowboy_test:init_http(Name, #{ env => #{dispatch => init_dispatch()} }, Config). @@ -90,34 +73,6 @@ init_dispatch() -> %% Tests. -autobahn_fuzzingclient(Config) -> - doc("Autobahn test suite for the Websocket protocol."), - Self = self(), - spawn_link(fun() -> do_start_port(Config, Self) end), - receive autobahn_exit -> ok end, - ct:log("<h2><a href=\"log_private/reports/servers/index.html\">Full report</a></h2>~n"), - Report = config(priv_dir, Config) ++ "reports/servers/index.html", - ct:print("Autobahn Test Suite report: file://~s~n", [Report]), - {ok, HTML} = file:read_file(Report), - case length(binary:matches(HTML, <<"case_failed">>)) > 2 of - true -> error(failed); - false -> ok - end. - -do_start_port(Config, Pid) -> - Port = open_port({spawn, "wstest -m fuzzingclient -s " ++ config(data_dir, Config) ++ "client.json"}, - [{line, 10000}, {cd, config(priv_dir, Config)}, binary, eof]), - do_receive_infinity(Port, Pid). - -do_receive_infinity(Port, Pid) -> - receive - {Port, {data, {eol, Line}}} -> - io:format(user, "~s~n", [Line]), - do_receive_infinity(Port, Pid); - {Port, eof} -> - Pid ! autobahn_exit - end. - unlimited_connections(Config) -> doc("Websocket connections are not limited. The connections " "are removed from the count after the handshake completes."), |