daisy.communication.tests package

daisy.communication.tests.simple_acceptor module

Collection of various functions to test the acceptor-side (server) of the endpoint class. These test-functions can be called directly, with the main on the bottom adjusted for each test case.

daisy.communication.tests.simple_acceptor.clashing_acceptor()[source]

Creates multiple acceptor endpoints that have the same address (which is supported by the underlying endpoint sockets) but also the same remote (initiator) address which should result in a double registration causing an error.

daisy.communication.tests.simple_acceptor.multithreaded_acceptor(num_threads: int)[source]

Starts n acceptor endpoints as separate threads, to test if endpoints can work in tandem using the shared underlying class attributes of the endpoint socket.

Parameters:

num_threads – Number of acceptor threads to start.

daisy.communication.tests.simple_acceptor.simple_acceptor()[source]

Creates and starts an acceptor to perform an endless ping-pong tests with the opposing initiator, sending out “pong” and receiving “ping” messages.

daisy.communication.tests.simple_acceptor.single_message_acceptor()[source]

Creates and starts an acceptor to perform a single receive before stopping the endpoint, to test if endpoints can be stopped while they are receiving multiple messages.

daisy.communication.tests.simple_acceptor.threaded_acceptor(t_id: int)[source]

Creates and starts an acceptor with a specific ID to perform an endless ping-pong tests with the opposing initiator, sending out “pong” and receiving “ping” messages. In addition, at random intervals, stops or even shutdowns the endpoint to start or create it anew to test the resilience of the two endpoints.

Parameters:

t_id – ID of thread.

daisy.communication.tests.simple_initiator module

Collection of various functions to test the initiator-side (client) of the endpoint class. These test-functions can be called directly, with the main on the bottom adjusted for each test case.

daisy.communication.tests.simple_initiator.multithreaded_initiator(num_threads: int)[source]

Starts n initiator endpoints as separate threads, to test if endpoints can work in tandem using the shared underlying class attributes of the endpoint socket.

Parameters:

num_threads – Number of acceptor threads to start.

daisy.communication.tests.simple_initiator.one_time_initiator()[source]

Creates and starts an initiator to perform one multiple “ping” sends before stopping the endpoint, all of which done through the helper class method of the endpoint class.

daisy.communication.tests.simple_initiator.simple_initiator()[source]

Creates and starts an initiator to perform an endless ping-pong tests with the opposing initiator, sending out “ping” and receiving “pong” messages.

daisy.communication.tests.simple_initiator.single_message_initiator()[source]

Creates and starts an initiator to perform a single send before stopping the endpoint, to test if endpoints can be stopped while they are about to send a message. This test is not deterministic due to scheduling.

daisy.communication.tests.simple_initiator.threaded_initiator(t_id: int)[source]

Creates and starts an initiator with a specific ID to perform an endless ping-pong tests with the opposing acceptor, sending out “ping” and receiving “pong” messages. In addition, at random intervals, stops or even shutdowns the endpoint to start or create it anew to test the resilience of the two endpoints.

Parameters:

t_id – ID of thread.

daisy.communication.tests.simple_server module

Simple addition to the Acceptor/Initiator ping-pong tests, that creates a server to regularly polls its (acceptor) endpoint connections to receive “pings” and respond with “pongs”, to test the behavior of handling concurrent connections.

daisy.communication.tests.simple_server.simple_server()[source]

Setup and start of ping-pong server (see module docstring).

Module contents

Collection of various tests of the message stream module for endpoints and endpoint server. These tests are merely for development purposes only and are not unit-test compliant. Due to the nature of multi-threading, these tests may or may not be deterministic as well.

Currently, the following test-modules are provided:

  • simple_acceptor - Acceptor endpoint (server) side test functions.

  • simple_initiator - Initiator endpoint (client) side test functions.

  • simple_server - Dedicated endpoint server function to create test servers.

To start any tests, initiator(s) must always be launched in tandem with either acceptors(s) or a server from their respective modules. Some acceptor tests can also be launched in standalone manner. See their modules’ and their respective functions’ docstrings for more information.