[erlang-questions] common_test and multiple nodes
Wed Jun 29 10:01:28 CEST 2011
Large scale testing is indeed for running unrelated tests across several machines at the same time and then gathering the results.
The tests for testing common_test sound very similar to what you want to do. What we do there is that we in the init_per_testcase startup X number of nodes and install our own event handlers on those nodes which register the events that happen and send them to the common_test node. Then we verify that the events which we received from the nodes is one of the possible (race conditions suck) outcomes of the test run which we are testing.
You can find the test suite here: https://github.com/erlang/otp/blob/dev/lib/common_test/test/ct_hooks_SUITE.erl
Keep in mind that the SUITE was originally written to run on only the test_server, so there are some strange things going on in there which could be a lot better done now that ct is used to run the tests. For instance you probably want to use ct_slave to start and monitor nodes which you start.
----- Original Message -----
From: "Bernie Duggan" <bernie@REDACTED>
To: "Erlang Questions" <erlang-questions@REDACTED>
Sent: Wednesday, June 29, 2011 2:32:30 AM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
Subject: [erlang-questions] common_test and multiple nodes
I'm in the process of writing up some common_test based tests for a system we're developing. While common_test seems to basically be pretty cool, I have one thing that I can't quite see how to do (of course I may be looking at the problem entirely the wrong way, too).
Our code can be looked at as behaving like a client-server system (actually it's more like a peer-peer, but it's easier to explain this way and doesn't really affect the question). What I'd like to be able to do is fire up a server on one node with some test hooks (so that we can watch what's happening), and a client on another node. Then, we have tests running on both of them to ensure that a) the client is seeing the responses it's expecting, and b) the server is behaving internally the way we expect for the given client input.
It seems like common_test has /most/ of what I want for this as part of the "large scale testing" features (ability to start up remote nodes and run tests on them, having failures fed back to the master node etc). Except that I can't see a way to guarantee that, for example, client_test_1 runs on the client node at the same time as the corresponding server_test_1 runs on the server node. It looks like the large scale testing stuff is basically designed to run a whole pile of tests in parallel across multiple nodes, without any interaction between them. Is this correct? If not, what am I missing? If so, are there any suggestions for an alternative approach to the problem?
erlang-questions mailing list
More information about the erlang-questions