user41871
user41871

Reputation:

Test harness software for networking failures

During integration testing it is important to simulate various kinds of low-level networking failure to ensure that the components involved properly handle them. Some socket connection examples (from the Release It! book by Michael Nygard) include

and so forth.

It would be useful to simulate such failures for integration testing involving web services, database calls and so forth.

Are there any tools available able to create failure conditions of this specific sort (i.e. socket-level failures)? One possibility, for instance, would be some kind of dysfunctional server that exhibits different kinds of failure on different ports.

EDIT: After some additional research, it looks like it's possible to handle this kind of thing using a firewall. For example iptables has some options that allow you to match packets (either randomly according to some configurable probability or else on an every-nth-packet basis) and then drop them. So I am thinking that we might set up our "nasty server" with the firewall rules configured on a port-by-port basis to create the kind of nastiness we want to test our apps against. Would be interested to hear thoughts about this approach.

Upvotes: 4

Views: 1292

Answers (3)

rud
rud

Reputation: 1020

bane is built for this purpose, described as:

Bane is a test harness used to test your application's interaction with other servers. It is based upon the material from Michael Nygard's "Release It!" book as described in the "Test Harness" chapter.

(Edit 2021): a more developed tool for testing behavior with different network issues is toxiproxy

Toxiproxy is a framework for simulating network conditions. It's made specifically to work in testing, CI and development environments, supporting deterministic tampering with connections, but with support for randomized chaos and customization. Toxiproxy is the tool you need to prove with tests that your application doesn't have single points of failure.

Upvotes: 3

Andrew McGregor
Andrew McGregor

Reputation: 34602

You can do it with iptables, or you can do it without actually sending the packets anywhere with ns-3, possibly combined with your favourite virtualisation solution, or you can do all sorts of strange things with scapy.

Upvotes: 1

Nikolai Fetissov
Nikolai Fetissov

Reputation: 84151

Take a look at the dummynet.

Upvotes: 1

Related Questions