diff --git a/testing/btest/Files/zeromq/single-node.zeek b/testing/btest/Files/zeromq/single-node.zeek new file mode 100644 index 0000000000..af604e54dc --- /dev/null +++ b/testing/btest/Files/zeromq/single-node.zeek @@ -0,0 +1,24 @@ +# Helper script expecting XPUB_PORT / XSUB_PORT environments +# and redefining the ZeroMQ options accordingly and starting +# the zmq_proxy_thread. +# +# This is primarily useful for testing of WebSocket functionality +# while the ZeroMQ backend is enabled. +@load base/utils/numbers + +@load frameworks/cluster/backend/zeromq + +const local_addr_str = "127.0.0.1" &redef; +redef Cluster::Backend::ZeroMQ::listen_xpub_endpoint = fmt("tcp://%s:%s", local_addr_str, port_to_count(to_port(getenv("XPUB_PORT")))); +redef Cluster::Backend::ZeroMQ::listen_xsub_endpoint = fmt("tcp://%s:%s", local_addr_str, port_to_count(to_port(getenv("XSUB_PORT")))); +redef Cluster::Backend::ZeroMQ::connect_xpub_endpoint = fmt("tcp://%s:%s", local_addr_str, port_to_count(to_port(getenv("XSUB_PORT")))); +redef Cluster::Backend::ZeroMQ::connect_xsub_endpoint = fmt("tcp://%s:%s", local_addr_str, port_to_count(to_port(getenv("XPUB_PORT")))); + +event zeek_init() &priority=100 + { + if ( ! Cluster::Backend::ZeroMQ::spawn_zmq_proxy_thread() ) + Reporter::fatal("Failed to spawn ZeroMQ proxy thread"); + + if ( ! Cluster::init() ) + Reporter::fatal("Failed to initialize ZeroMQ backend"); + } diff --git a/testing/btest/cluster/websocket/terminate-while-queuing.zeek b/testing/btest/cluster/websocket/terminate-while-queuing.zeek index 787f02671a..510f09a455 100644 --- a/testing/btest/cluster/websocket/terminate-while-queuing.zeek +++ b/testing/btest/cluster/websocket/terminate-while-queuing.zeek @@ -2,9 +2,13 @@ # # @TEST-REQUIRES: python3 -c 'import websockets.sync' # +# @TEST-PORT: XPUB_PORT +# @TEST-PORT: XSUB_PORT # @TEST-PORT: WEBSOCKET_PORT # +# @TEST-EXEC: cp $FILES/zeromq/single-node.zeek zeromq-single-node.zeek # @TEST-EXEC: cp $FILES/ws/wstest.py . +# # @TEST-EXEC: zeek -b --parse-only manager.zeek # @TEST-EXEC: python3 -m py_compile client.py # @@ -19,6 +23,8 @@ # @TEST-EXEC: btest-diff ./client/.stderr # @TEST-START-FILE manager.zeek +@load zeromq-single-node + redef exit_only_after_terminate = T; # Force dispatcher queue being full quickly!