liminal-server 0.25.4

Standalone server for the liminal messaging bus
Documentation
//! SRV-043 R2 over the WebSocket process: a connection the server's stop
//! closes before its readiness registers is logged below ERROR and torn down
//! exactly as a failed one.

use crate::ServerError;
use crate::server::connection::process::readiness_stop_tests::{
    check_stop_and_failure, logged_while,
};

#[test]
fn a_websocket_connection_the_stop_closes_logs_no_error_and_is_torn_down_as_a_failed_one()
-> Result<(), String> {
    let (mut stopped, _stopped_client) = super::tests::scheduler_free_process()?;
    let (mut failed, _failed_client) = super::tests::scheduler_free_process()?;
    check_stop_and_failure(
        logged_while(|| stopped.fail_slice(7, &ServerError::ReadinessClosedByStop { pid: 7 })),
        logged_while(|| {
            failed.fail_slice(
                8,
                &ServerError::ListenerAccept {
                    message:
                        "failed to register connection readiness: readiness poll thread has failed"
                            .to_owned(),
                },
            )
        }),
    );
    Ok(())
}