Bitcoin Core 29.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
mp::test::TestSetup Class Reference

Test setup class creating a two way connection between a ProxyServer<FooInterface> object and a ProxyClient<FooInterface>. More...

Collaboration diagram for mp::test::TestSetup:
[legend]

Public Member Functions

 TestSetup (bool client_owns_connection=true)
 
 ~TestSetup ()
 

Public Attributes

std::function< void()> server_disconnect
 
std::function< void()> client_disconnect
 
std::promise< std::unique_ptr< ProxyClient< messages::FooInterface > > > client_promise
 
std::unique_ptr< ProxyClient< messages::FooInterface > > client
 
ProxyServer< messages::FooInterface > * server {nullptr}
 
std::thread thread
 Thread variable should be after other struct members so the thread does not start until the other members are initialized. More...
 

Detailed Description

Test setup class creating a two way connection between a ProxyServer<FooInterface> object and a ProxyClient<FooInterface>.

Provides client_disconnect and server_disconnect lambdas that can be used to trigger disconnects and test handling of broken and closed connections.

Accepts a client_owns_connection option to test different ProxyClient destroy_connection values and control whether destroying the ProxyClient object destroys the client Connection object. Normally it makes sense for this to be true to simplify shutdown and avoid needing to call client_disconnect manually, but false allows testing more ProxyClient behavior and the "IPC client method called after disconnect" code path.

Definition at line 49 of file test.cpp.

Constructor & Destructor Documentation

◆ TestSetup()

mp::test::TestSetup::TestSetup ( bool  client_owns_connection = true)
inline

Definition at line 61 of file test.cpp.

◆ ~TestSetup()

mp::test::TestSetup::~TestSetup ( )
inline

Definition at line 98 of file test.cpp.

Member Data Documentation

◆ client

std::unique_ptr<ProxyClient<messages::FooInterface> > mp::test::TestSetup::client

Definition at line 55 of file test.cpp.

◆ client_disconnect

std::function<void()> mp::test::TestSetup::client_disconnect

Definition at line 53 of file test.cpp.

◆ client_promise

std::promise<std::unique_ptr<ProxyClient<messages::FooInterface> > > mp::test::TestSetup::client_promise

Definition at line 54 of file test.cpp.

◆ server

ProxyServer<messages::FooInterface>* mp::test::TestSetup::server {nullptr}

Definition at line 56 of file test.cpp.

◆ server_disconnect

std::function<void()> mp::test::TestSetup::server_disconnect

Definition at line 52 of file test.cpp.

◆ thread

std::thread mp::test::TestSetup::thread

Thread variable should be after other struct members so the thread does not start until the other members are initialized.

Definition at line 59 of file test.cpp.


The documentation for this class was generated from the following file: