During integration testing, it is important to model various types of low-level network failures to ensure that the appropriate components handle them properly. Some examples of socket connections (from Release It! By Michael Nygard) include
- Disconnected
- remote end response using SYN / ACK but never sends any data
- the remote end sends only RESET packets
- a connection is established, but the remote end never acknowledges the packets, causing endless retransmissions.
etc.
It would be useful to simulate such failures for integration testing using web services, database calls, etc.
Are there any tools that can create failure conditions of this particular type (for example, failures at the socket level)? One of the possibilities, for example, can be a kind of dysfunctional server that shows different types of failures on different ports.
EDIT: After some additional research, it seems like you can handle these things with a firewall. For example, iptables has several options that allow you to match packets (either randomly according to some configurable probability, or based on every nth packet), and then discard them. Therefore, I think that we could configure our "nasty server" with the firewall rules configured on the basis of porting in order to create such muck with which we want to test our applications. It would be interesting to hear thoughts about this approach.
source
share