tests.test_hear_cleanup
Test module for verifying cleanup behavior of the multicast hearing mechanism.
This module contains test suites that verify proper resource cleanup and process termination when the multicast hearing process receives shutdown signals.
Module Contents
Classes
Test suite for verifying the cleanup behavior of the multicast hearing mechanism. |
Data
API
- tests.test_hear_cleanup.__module__[source]
‘tests’
- class tests.test_hear_cleanup.HearCleanupTestSuite(methodName='runTest')[source][source]
Bases:
context.BasicUsageTestSuiteTest suite for verifying the cleanup behavior of the multicast hearing mechanism.
This suite tests that the
McastHEARclass correctly releases resources and terminates gracefully when the hearing process receives a “STOP Test” message. It ensures that sockets are properly closed and no lingering processes remain after execution, adhering to the expected cleanup protocols.Initialization
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- __module__[source]
‘tests.test_hear_cleanup’
- __name__[source]
‘tests.test_hear_cleanup.HearCleanupTestSuite’
- STOP_DELAY_SECONDS: int[source]
1
Time to wait for server cleanup after sending
STOP.Must be > 0 to ensure server has an opportunity to handle messages.
- KILL_DELAY_SECONDS: int[source]
3
Average time to wait for process completion after sending
STOPbefore sendingSIGKILL.Should be sufficient for handling
STOPmessages but not too long.
- PROCESS_TIMEOUT_SECONDS: int[source]
15
Maximum time to wait for process completion after sending
STOP.Should be sufficient for cleanup but not too long.
- EXPECTED_STOP_EXIT_CODE: int[source]
0
Expected exit code when process receives
STOPmessages.0=successas per POSIX convention.
- test_cleanup_on_exit() None[source][source]
Test proper cleanup of McastHEAR when receiving STOP message.
Prerequisites: - Available test port (self._the_test_port) - Multicast group 224.0.0.1 accessible
Expected behavior: 1. Start McastHEAR process in daemon mode 2. Send “STOP Test” message 3. Verify process terminates cleanly 4. Ensure all resources are released
Success criteria: - Process exits with code 0 - No lingering processes or sockets