userver: pytest_userver.chaos.UdpGate Class Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts

Your opinion will help to improve our service

Leave a feedback >

Detailed Description

Implements UDP chaos-proxy logic such as demuxing incoming datagrams from different clients.

Separate connections to server are made for each new client.

See also
Chaos Testing

Definition at line 944 of file chaos.py.

+ Inheritance diagram for pytest_userver.chaos.UdpGate:

Public Member Functions

 __init__ (self, GateRoute route, typing.Optional[EvLoop] loop=None)
 
bool is_connected (self)
 Returns True if there is active pair of sockets ready to transfer data at the moment.
 
None to_server_concat_packets (self, int packet_size)
 Pass data in bigger parts.
 
None to_client_concat_packets (self, int packet_size)
 Pass data in bigger parts.
 
None to_server_smaller_parts (self, int max_size, *float sleep_per_packet=0)
 Pass data to server in smaller parts.
 
None to_client_smaller_parts (self, int max_size, *float sleep_per_packet=0)
 Pass data to client in smaller parts.
 

Protected Member Functions

typing.List[Socket] _create_accepting_sockets (self)
 
 _connect_to_server (self)
 
None _collect_garbage (self)
 
 _do_accept (self, Socket accept_sock)
 This task should wait for connections and create SocketPair.
 

Protected Attributes

 _sockets
 
 _clients
 
 _loop
 
 _to_server_intercept
 
 _to_client_intercept
 

Constructor & Destructor Documentation

◆ __init__()

pytest_userver.chaos.UdpGate.__init__ (   self,
GateRoute  route,
typing.Optional[EvLoop]   loop = None 
)

Reimplemented from pytest_userver.chaos.BaseGate.

Definition at line 955 of file chaos.py.

Member Function Documentation

◆ _collect_garbage()

None pytest_userver.chaos.UdpGate._collect_garbage (   self)
protected

Reimplemented from pytest_userver.chaos.BaseGate.

Definition at line 997 of file chaos.py.

◆ _connect_to_server()

pytest_userver.chaos.UdpGate._connect_to_server (   self)
protected

Definition at line 981 of file chaos.py.

◆ _create_accepting_sockets()

typing.List[Socket] pytest_userver.chaos.UdpGate._create_accepting_sockets (   self)
protected

Reimplemented from pytest_userver.chaos.BaseGate.

Definition at line 966 of file chaos.py.

◆ _do_accept()

pytest_userver.chaos.UdpGate._do_accept (   self,
Socket  accept_sock 
)
protected

This task should wait for connections and create SocketPair.

Reimplemented from pytest_userver.chaos.BaseGate.

Definition at line 1001 of file chaos.py.

◆ is_connected()

bool pytest_userver.chaos.UdpGate.is_connected (   self)

Returns True if there is active pair of sockets ready to transfer data at the moment.

Definition at line 959 of file chaos.py.

◆ to_client_concat_packets()

None pytest_userver.chaos.UdpGate.to_client_concat_packets (   self,
int  packet_size 
)

Pass data in bigger parts.

Parameters
packet_sizeminimal size of the resulting packet

Reimplemented from pytest_userver.chaos.BaseGate.

Definition at line 1038 of file chaos.py.

◆ to_client_smaller_parts()

None pytest_userver.chaos.UdpGate.to_client_smaller_parts (   self,
int  max_size,
*float   sleep_per_packet = 0 
)

Pass data to client in smaller parts.

Parameters
max_sizeMax packet size to send to client
sleep_per_packetOptional sleep interval per packet, seconds

Reimplemented from pytest_userver.chaos.BaseGate.

Definition at line 1049 of file chaos.py.

◆ to_server_concat_packets()

None pytest_userver.chaos.UdpGate.to_server_concat_packets (   self,
int  packet_size 
)

Pass data in bigger parts.

Parameters
packet_sizeminimal size of the resulting packet

Reimplemented from pytest_userver.chaos.BaseGate.

Definition at line 1035 of file chaos.py.

◆ to_server_smaller_parts()

None pytest_userver.chaos.UdpGate.to_server_smaller_parts (   self,
int  max_size,
*float   sleep_per_packet = 0 
)

Pass data to server in smaller parts.

Parameters
max_sizeMax packet size to send to server
sleep_per_packetOptional sleep interval per packet, seconds

Reimplemented from pytest_userver.chaos.BaseGate.

Definition at line 1041 of file chaos.py.

Member Data Documentation

◆ _clients

pytest_userver.chaos.UdpGate._clients
protected

Definition at line 999 of file chaos.py.

◆ _loop

pytest_userver.chaos.UdpGate._loop
protected

Definition at line 1024 of file chaos.py.

◆ _sockets

pytest_userver.chaos.UdpGate._sockets
protected

Definition at line 964 of file chaos.py.

◆ _to_client_intercept

pytest_userver.chaos.UdpGate._to_client_intercept
protected

Definition at line 1028 of file chaos.py.

◆ _to_server_intercept

pytest_userver.chaos.UdpGate._to_server_intercept
protected

Definition at line 1027 of file chaos.py.


The documentation for this class was generated from the following file:
  • /data/code/userver/testsuite/pytest_plugins/pytest_userver/chaos.py