From eab33e51df0a846ac3434d37b172ca5a64885410 Mon Sep 17 00:00:00 2001 From: joewilliams Date: Thu, 12 Apr 2012 13:23:53 -0700 Subject: [PATCH] move test files around --- ...http_checks.erl => folsom_http_checks.erl} | 45 ++++++++++++++++++- ...achine.erl => folsom_webmachine_tests.erl} | 2 +- 2 files changed, 44 insertions(+), 3 deletions(-) rename test/{folsom_webmachine_http_checks.erl => folsom_http_checks.erl} (73%) rename test/{folsom_webmachine.erl => folsom_webmachine_tests.erl} (97%) diff --git a/test/folsom_webmachine_http_checks.erl b/test/folsom_http_checks.erl similarity index 73% rename from test/folsom_webmachine_http_checks.erl rename to test/folsom_http_checks.erl index c76f5a6..976f1e1 100644 --- a/test/folsom_webmachine_http_checks.erl +++ b/test/folsom_http_checks.erl @@ -16,13 +16,13 @@ %%%------------------------------------------------------------------- -%%% File: folsom_webmachine_http_checks.erl +%%% File: folsom_http_checks.erl %%% @author joe williams %%% @doc %%% @end %%%------------------------------------------------------------------ --module(folsom_webmachine_http_checks). +-module(folsom_http_checks). -include_lib("eunit/include/eunit.hrl"). @@ -32,6 +32,10 @@ -define(STATISTICS_URL, "http://localhost:5565/_statistics"). -define(MEMORY_URL, "http://localhost:5565/_memory"). -define(BASE_METRICS_URL, "http://localhost:5565/_metrics"). +-define(HEALTH_URL, "http://localhost:5565/_health"). +-define(PING_URL, "http://localhost:5565/_ping"). +-define(PORT_URL, "http://localhost:5565/_port"). +-define(PROCESS_URL, "http://localhost:5565/_process"). run() -> metrics_checks(), @@ -39,6 +43,10 @@ run() -> system_checks(), statistics_checks(), memory_checks(), + ping_checks(), + health_checks(), + port_checks(), + process_checks(), create_metric(), populate_metric(), @@ -86,6 +94,38 @@ memory_checks() -> % verify one of the many keys exist true = lists:keymember(<<"total">>, 1, List1). +ping_checks() -> + % make sure ping works + Body1 = http_helpers:http_get(?PING_URL), + {struct, List1} = mochijson2:decode(Body1), + + % verify one of the many keys exist + true = lists:keymember(<<"pong">>, 1, List1). + +health_checks() -> + % make sure ping works + Body1 = http_helpers:http_get(?HEALTH_URL), + {struct, List1} = mochijson2:decode(Body1), + + % verify one of the many keys exist + true = lists:keymember(<<"health">>, 1, List1). + +process_checks() -> + % make sure process works + Body1 = http_helpers:http_get(?PROCESS_URL), + {struct, List1} = mochijson2:decode(Body1), + + % verify one of the many keys exist + true = lists:keymember(<<"<0.0.0>">>, 1, List1). + +port_checks() -> + % make sure process works + Body1 = http_helpers:http_get(?PORT_URL), + {struct, List1} = mochijson2:decode(Body1), + + % verify one of the many keys exist + true = lists:keymember(<<"#Port<0.1>">>, 1, List1). + create_metric() -> Proplist = [ {id, "http"}, @@ -114,3 +154,4 @@ populate_metric() -> delete_metric() -> Url1 = lists:append(io_lib:format("~s~s", [?BASE_METRICS_URL, "/http"])), ok = http_helpers:http_delete(Url1). + diff --git a/test/folsom_webmachine.erl b/test/folsom_webmachine_tests.erl similarity index 97% rename from test/folsom_webmachine.erl rename to test/folsom_webmachine_tests.erl index 1c241e7..966e51c 100644 --- a/test/folsom_webmachine.erl +++ b/test/folsom_webmachine_tests.erl @@ -22,7 +22,7 @@ %%% @end %%%------------------------------------------------------------------ --module(folsom_webmachine). +-module(folsom_webmachine_tests). -include_lib("eunit/include/eunit.hrl").