EQC tests and a simple eunit test to run them. #11

Merged
merged 7 commits into from Feb 28, 2012

2 participants

@massung

No description provided.

@jtuple

Lager is now a dependency for riak_core, so your test no longer works
against Riak master/1.1. You'll need to add lager to the list of applications
you spin up. Or, even use the built-in dependency management feature of Riak
so that you don't need to list apps explicitly.

Adding lager:

--- a/test/eqc_routes.erl
+++ b/test/eqc_routes.erl
@@ -36,6 +36,7 @@ prop_routes () ->
                                                    riak_sysmon,
                                                    webmachine,
                                                    os_mon,
+                                                   lager,
                                                    riak_core,
                                                    riak_control]],

Using built-in dependency management:

--- a/test/eqc_routes.erl
+++ b/test/eqc_routes.erl
@@ -30,14 +30,9 @@ prop_routes () ->
                 setup(Auth),

                 %% start applications
-                [application:start(App) || App <- [sasl,
-                                                   crypto,
-                                                   inets,
-                                                   riak_sysmon,
-                                                   webmachine,
-                                                   os_mon,
-                                                   riak_core,
-                                                   riak_control]],
+                riak_core_util:start_app_deps(riak_core),
+                riak_core_util:start_app_deps(riak_control),
+                application:start(riak_control),

You currently have the SSL certificates hard-coded to a path in your home
directory. I imagine there are many ways to change this to be portable, but
I think the easiest would be to use the priv_dir support provided by Erlang.
In my testing, I copied riak/rel/files/*.pem to riak_control/priv and
modified the code as follows:

--- a/test/eqc_routes.erl
+++ b/test/eqc_routes.erl
@@ -197,8 +192,9 @@ setup (Auth) ->
     %% set env values for riak core
     set(http, [{"127.0.0.1",18098}]),
     set(https, [{"127.0.0.1",18069}]),
-    set(ssl, [{certfile, "/Users/jeff/Projects/b/riak/rel/files/cert.pem"},
-              {keyfile, "/Users/jeff/Projects/b/riak/rel/files/key.pem"}
+    CertPath = code:priv_dir(riak_control),
+    set(ssl, [{certfile, CertPath ++ "/cert.pem"},
+              {keyfile, CertPath ++ "/key.pem"}
              ]),

After these minor changes, the EQC tests passed several runs. Even when I
temporarily changed EQC to generate 1000 tests as well as modified the
command generator to generate 10x larger command sequences.

So, just need to fix the lager and SSL cert issues.

@massung massung Fixed startup applications (per Joe's suggestion) and made the cert f…
…iles local to the test instead of hard-coded paths.
fd35afa
@massung

Updated based on Joe's suggestions. Tests run an pass still.

@massung massung merged commit deaac86 into master Feb 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment