Merge pull request #52 from basho/jd-riak_lager_test

Ported riak_lager tests from basho_expect
This commit is contained in:
Joe DeVivo 2012-09-12 09:04:54 -07:00
commit 793b66488d

View File

@ -0,0 +1,32 @@
-module(verify_riak_lager).
-export([confirm/0]).
-include_lib("eunit/include/eunit.hrl").
-include_lib("kernel/include/file.hrl").
-define(UNIX_RW_R__R__, 8#100644).
confirm() ->
lager:info("Staring a node"),
Nodes = [Node] = rt:deploy_nodes(1),
?assertEqual(ok, rt:wait_until_nodes_ready(Nodes)),
lager:info("Stopping that node"),
rt:stop(Node),
rt:start(Node),
lager:info("Checking for log files"),
{ok, LagerHandlers} = rt:rpc_get_env(Node, [{lager, handlers}]),
Files = [element(1, Backend) || Backend <- proplists:get_value(lager_file_backend, LagerHandlers)],
lager:info("Checking for files: ~p", [Files]),
[?assert(rpc:call(Node, filelib, is_file, [File])) || File <- Files],
FileInfos = [ FileInfo || {ok, FileInfo} <- [rpc:call(Node, file, read_file_info, [File]) || File <- Files]],
[?assertEqual(?UNIX_RW_R__R__, ?UNIX_RW_R__R__ band FileInfo#file_info.mode) || FileInfo <- FileInfos],
pass.