Test Server Questions

Sean Cribbs sean at basho.com
Thu Jul 28 19:15:32 EDT 2011


Keith,


> 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
meaningful way.


> 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.

Cheers,

-- 
Sean Cribbs <sean at basho.com>
Developer Advocate
Basho Technologies, Inc.
http://www.basho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110728/cbd4ec0f/attachment.html>


More information about the riak-users mailing list