27.08.2010 12:52, Dmitry Demeshchuk пишет:
On Fri, Aug 27, 2010 at 12:47 PM, Dmitry Vasiliev<d...@hlabs.org>  wrote:
Hi all,

I'm start to use Riak in one of my Erlang based projects and looking for a
ways to automatic test my application with Riak. Is there an easy way to
start/stop some lightweight Riak instance (for example with ets backend) in
tests or I need to emulate Riak's client API myself?

There are 2 Riak API's for Erlang: native and protobuffs.

Protocol Buffers API is better if you're going to connect to remote
nodes as its data format is very compact.
Native API is a bit more convenient for me so I prefer it if not
working with remote nodes.

I use native API myself. But is the difference between Protocol Buffers format and Erlang's External Term format so huge that you can see it in real world applications? I hardly believe so.

As for tests, you can pre-create a ETS-based bucket (you can either
set its properties in the app.config file or manually from Erlang) and
run some test operations on it upon Riak client start. So, there's no
need in an additional instance as your buckets can use different
storages.

Actually that I want to do is to start and stop some Riak emulation right in the tests like this:

some_test_setup() ->
    start_lightweight_riak_process().

some_test_cleanup() ->
    stop_lightweight_riak_process().

some_test() ->
    some_test_setup(),
    {ok, Client} = riak:local_client(),
    ... % Some tests with the Client
    some_test_cleanup().

Now I use my storage API as frontend for Riak's API so I can emulate my API (or Riak's API) with ets but first I want to know can I do my tests a lazy way. :-)

--
Dmitry Vasiliev <dima at hlabs.org>
http://hlabs.org
http://twitter.com/hdima

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to