Public Member Functions | |
testInitialization (self) | |
testRunSending (self) | |
testEndRun (self) | |
setUp (self) | |
start (self) | |
tearDown (self) | |
assertIsDown (self, name, timeout=5, minimum_delay=0.1) | |
assertIsRunning (self, name) | |
assertMonitoring (self, socket, search_key, search_value, timeout=10) | |
assertIsAndGet (self, socket, message_type, final=True, router=False) | |
assertIsMsgType (self, socket, message_type, final=True, router=False) | |
assertNothingMore (self, socket) | |
assertHasOutputFile (self, output_file, unlink=True, timeout=0.5, minimum_delay=0.1) | |
assertNotHasOutputFile (self, output_file, timeout=0.5) | |
Static Public Member Functions | |
get_free_port () | |
create_socket (port, socket_type=zmq.DEALER, identity="socket", bind=False) | |
create_router_socket (port) | |
send (socket, message_type, first_data=b"", second_data=b"", identity="") | |
recv (socket) | |
Public Attributes | |
input_socket | |
input_socket | |
output_socket | |
output_socket | |
output_identity = self.assertIsMsgType(self.output_socket, "h", router=True)[0].decode() | |
output_identity | |
input_identity = self.assertIsMsgType(self.input_socket, "r", router=True, final=False)[0].decode() | |
input_identity | |
list | first_run_event_data = [self.event_data, self.event_data] |
some data | |
list | second_run_event_data = [self.event_data, self.event_data] |
some data | |
test_dir = tempfile.mkdtemp() | |
use a temporary folder for testing | |
previous_dir = os.getcwd() | |
remember current working directory | |
started_programs = dict() | |
dict for all started programs | |
tearDown = subprocess.Popen(command, start_new_session=True) | |
Static Public Attributes | |
event_data = open(basf2.find_file("daq/hbasf2/tests/out.raw"), "br").read() | |
event_data | |
list | extra_arguments = [] |
extra arguments to pass to the worker script | |
ctx = zmq.Context() | |
The ZMQ context. | |
needed_programs = dict() | |
The dict name -> cmd args of the programs to start, needs to be set in each test. | |
Protected Member Functions | |
_is_running (self, name) | |
Tests for normal worker behavior
Definition at line 58 of file test_worker.py.
|
protectedinherited |
Check if a given program is still running.
Definition at line 84 of file test_support.py.
|
inherited |
Assert that - at least after the given timeout - the output file is present. If unlink is set to True, remove the file after checking.
Definition at line 227 of file test_support.py.
|
inherited |
Assert that the next message received on the socket has the given message type. If final is set to True, also assert that there is no additional message on the socket. Use router only for router sockets.
Definition at line 200 of file test_support.py.
|
inherited |
Test helper to assert the given program has terminated - at least after timeout in seconds has passed. Checks every "minimal_delay seconds.
Definition at line 93 of file test_support.py.
|
inherited |
Deprecated copy of "assertIsAndGet".
Definition at line 215 of file test_support.py.
|
inherited |
Assert that a given program is still running.
Definition at line 108 of file test_support.py.
|
inherited |
Ask the given socket for a monitoring JSON and make sure, the value related to "search_key" is set to "search_value" - at least after the given timeout. The search key can should be in the form "<category>.<key>".
Definition at line 169 of file test_support.py.
|
inherited |
Assert that after the timeout the given file is not present (a.k.a. no process has created it)
Definition at line 245 of file test_support.py.
|
inherited |
Assert that there is no pending message to be received on the socket.
Definition at line 221 of file test_support.py.
|
staticinherited |
Shortcut to create a ROUTER type socket with the typical parameters binding to the given port.
Definition at line 140 of file test_support.py.
|
staticinherited |
Create and return a ZMQ socket with the given type and identity and bind or connect it to localhost and the given port.
Definition at line 115 of file test_support.py.
|
staticinherited |
Get a free port number by reusing ZMQ's function for this.
Definition at line 41 of file test_support.py.
|
staticinherited |
Try to receive a message from the socket (or throw an assertion error if none comes after the set timeout of the socket).
Definition at line 159 of file test_support.py.
|
staticinherited |
Send a message consisting of the message type, the first and the second data either to the identity if given or without identity if omitted.
Definition at line 148 of file test_support.py.
|
inherited |
Setup necessary sockets and programs
Reimplemented from HLTZMQTestCase.
Definition at line 24 of file test_worker.py.
|
inherited |
start the needed sockets and send some hello messages
Definition at line 40 of file test_worker.py.
|
inherited |
Custom tearDown function to kill the started programs if still present and remove the temporary folder again.
Definition at line 70 of file test_support.py.
testEndRun | ( | self | ) |
test function
Definition at line 84 of file test_worker.py.
testInitialization | ( | self | ) |
test function
Definition at line 61 of file test_worker.py.
testRunSending | ( | self | ) |
test function
Definition at line 68 of file test_worker.py.
|
staticinherited |
The ZMQ context.
Definition at line 36 of file test_support.py.
|
staticinherited |
event_data
Definition at line 19 of file test_worker.py.
|
staticinherited |
extra arguments to pass to the worker script
Definition at line 22 of file test_worker.py.
|
inherited |
some data
Definition at line 53 of file test_worker.py.
|
inherited |
input_identity
Definition at line 49 of file test_worker.py.
|
inherited |
input_socket
Definition at line 27 of file test_worker.py.
|
staticinherited |
The dict name -> cmd args of the programs to start, needs to be set in each test.
Definition at line 38 of file test_support.py.
|
inherited |
output_identity
Definition at line 44 of file test_worker.py.
|
inherited |
output_socket
Definition at line 29 of file test_worker.py.
|
inherited |
remember current working directory
Definition at line 58 of file test_support.py.
|
inherited |
some data
Definition at line 55 of file test_worker.py.
|
inherited |
dict for all started programs
Definition at line 62 of file test_support.py.
|
inherited |
Definition at line 68 of file test_support.py.
|
inherited |
use a temporary folder for testing
Definition at line 56 of file test_support.py.