Test Server Questions
sean at basho.com
Thu Jul 28 19:15:32 EDT 2011
> Is there any problem having a test server running on the same machine as a
> normal riak server, as long as the port number's don't collide? Assuming
> single-server setups, do we need to be concerned about any ports other than
> the http_port and pb_port?
There should be no problems running a test server alongside a development
server as long as the ports don't collide.
> If in a Ruby program I start a Riak test server, then shell out to an
> executable (using system or ``), will the server be responsive and available
> while the parent program is waiting for the shell command's return?
Yes, it is run as child process using popen3, so access to it is not
restricted to the parent process. However, generally since it designed to
be run in an ephemeral way, the testing process will be sending commands to
the node to clear its data regularly. You'll likely need to use the debugger
or some other blocking command to access the test server externally in a
> Is it possible to persist a test server's data to a file, say, a JSON file,
> and then load it on startup? If so, how?
This would be simple to do with very few lines of Ruby, but generally you
should be using factories (factory_girl, machinist) rather than "fixtures".
Test server's storage is completely in memory, and there's no sense of
transactions so you can't roll back to a previous state. This means if you
did go with "fixtures" strategy, they would need to be loaded at the
beginning of every test/example. That could get quite expensive. As you
would with a relational database, try to make your tests actually hit it as
little as possible.
Sean Cribbs <sean at basho.com>
Basho Technologies, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the riak-users