diff --git a/mix.exs b/mix.exs index c2c7c45..2c51d1b 100644 --- a/mix.exs +++ b/mix.exs @@ -5,8 +5,8 @@ defmodule ExStatsD.Mixfile do [app: :ex_statsd, version: "0.5.3", elixir: "~> 1.0", - package: package, - deps: deps, + package: package(), + deps: deps(), # Documentation name: "ex_statsd", source_url: "https://github.com/CargoSense/ex_statsd", diff --git a/test/lib/ex_statsd/decorator_test.exs b/test/lib/ex_statsd/decorator_test.exs index eb87c7f..fcd366a 100644 --- a/test/lib/ex_statsd/decorator_test.exs +++ b/test/lib/ex_statsd/decorator_test.exs @@ -59,13 +59,13 @@ defmodule ExStatsD.DecoratorTest do test "basic wrapper with defaults" do assert DecoratedModule.simple === :simple expected = [@prefix<>"simple_0:1.234|ms"] - assert sent == expected + assert sent() == expected end test "custom metric name" do assert DecoratedModule.custom_name === :custom_name expected = ["test.custom_key:1.234|ms"] - assert sent == expected + assert sent() == expected end test "custom metric name does not leak to next function" do @@ -75,7 +75,7 @@ defmodule ExStatsD.DecoratorTest do @prefix<>"custom_name_gone_0:1.234|ms", "test.custom_key:1.234|ms" ] - assert sent == expected + assert sent() == expected end test "custom metric name falling to next in match unless changed" do @@ -87,7 +87,7 @@ defmodule ExStatsD.DecoratorTest do "test.multi_0_or_1:1.234|ms", "test.multi_0_or_1:1.234|ms" ] - assert sent == expected + assert sent() == expected end test "tags are set and don't leak" do @@ -97,7 +97,7 @@ defmodule ExStatsD.DecoratorTest do @prefix<>"options_gone_0:1.234|ms", @prefix<>"with_options_0:1.234|ms|#mytag" ] - assert sent == expected + assert sent() == expected end test "tags fall through and get updated" do @@ -109,7 +109,7 @@ defmodule ExStatsD.DecoratorTest do @prefix<>"multi_options_1:1.234|ms|#options_fall_through", @prefix<>"multi_options_1:1.234|ms|#options_fall_through", ] - assert sent == expected + assert sent() == expected end test "send using histogram when enabled in all following functions" do @@ -119,7 +119,7 @@ defmodule ExStatsD.DecoratorTest do @prefix<>"multi_attrs_3:1.234|h", @prefix<>"multi_attrs_2:1.234|h" ] - assert sent == expected + assert sent() == expected end test "default options can be changed" do @@ -129,7 +129,7 @@ defmodule ExStatsD.DecoratorTest do @prefix<>"unbound_attr_1:1.234|h|#mine", @prefix<>"ignored_attr_1:1.234|h|#mine" ] - assert sent == expected + assert sent() == expected end defp sent, do: :sys.get_state(ExStatsD).sink diff --git a/test/lib/ex_statsd_test.exs b/test/lib/ex_statsd_test.exs index c1dfb4b..88cd974 100644 --- a/test/lib/ex_statsd_test.exs +++ b/test/lib/ex_statsd_test.exs @@ -17,7 +17,7 @@ defmodule ExStatsDTest do {:ok, _pid} = ExStatsD.start_link(options) - assert state.port == port + assert state().port == port end test "override host through options" do @@ -26,7 +26,7 @@ defmodule ExStatsDTest do {:ok, _pid} = ExStatsD.start_link(options) - assert state.host == String.to_atom(host) + assert state().host == String.to_atom(host) end test "override namespace through options" do @@ -35,7 +35,7 @@ defmodule ExStatsDTest do {:ok, _pid} = ExStatsD.start_link(options) - assert state.namespace == namespace + assert state().namespace == namespace end test "override sink through options" do @@ -44,14 +44,14 @@ defmodule ExStatsDTest do {:ok, _pid} = ExStatsD.start_link(options) - assert state.sink == sink + assert state().sink == sink end test "transmits data through correct server" do options = [name: :the_name] {:ok, _pid} = ExStatsD.start_link(options) - values = 1..100 |> ExStatsD.count("items", options) + _values = 1..100 |> ExStatsD.count("items", options) assert sent(:the_name) == ["test.items:100|c"] end @@ -65,43 +65,43 @@ defmodule ExStatsDTest do test "count (in pipeline)" do values = 1..100 |> ExStatsD.count("items") - assert sent == ["test.items:100|c"] + assert sent() == ["test.items:100|c"] assert values == 1..100 end test "counter (in pipeline)" do value = 3 |> ExStatsD.counter("items") - assert sent == ["test.items:3|c"] + assert sent() == ["test.items:3|c"] assert value == 3 end test "gauge (in pipeline)" do value = 3 |> ExStatsD.gauge("items") - assert sent == ["test.items:3|g"] + assert sent() == ["test.items:3|g"] assert value == 3 end test "increment" do ExStatsD.increment("events") - assert sent == ["test.events:1|c"] + assert sent() == ["test.events:1|c"] ExStatsD.increment("events", sample_rate: 0.15) end test "increment with tags" do ExStatsD.increment("events", tags: ["foo", "bar"]) - assert sent == ["test.events:1|c|#foo,bar"] + assert sent() == ["test.events:1|c|#foo,bar"] ExStatsD.increment("events", sample_rate: 0.15) end test "decrement" do ExStatsD.decrement("events") - assert sent == ["test.events:-1|c"] + assert sent() == ["test.events:-1|c"] ExStatsD.decrement("events", sample_rate: 0.15) end test "decrement with tags" do ExStatsD.decrement("events", tags: ["foo", "bar"]) - assert sent == ["test.events:-1|c|#foo,bar"] + assert sent() == ["test.events:-1|c|#foo,bar"] ExStatsD.decrement("events", sample_rate: 0.15) end @@ -112,49 +112,49 @@ defmodule ExStatsDTest do test "timer" do value = 12 |> ExStatsD.timer("fun.elapsed") - assert sent == ["test.fun.elapsed:12|ms"] + assert sent() == ["test.fun.elapsed:12|ms"] assert value == 12 end test "timer with tags" do value = 12 |> ExStatsD.timer("fun.elapsed", tags: ["foo", "bar"]) - assert sent == ["test.fun.elapsed:12|ms|#foo,bar"] + assert sent() == ["test.fun.elapsed:12|ms|#foo,bar"] assert value == 12 end test "gauge" do value = 11 |> ExStatsD.gauge("fun.thing") - assert sent == ["test.fun.thing:11|g"] + assert sent() == ["test.fun.thing:11|g"] assert value == 11 end test "gauge with tags" do value = 11 |> ExStatsD.gauge("fun.thing", tags: ["foo", "bar"]) - assert sent == ["test.fun.thing:11|g|#foo,bar"] + assert sent() == ["test.fun.thing:11|g|#foo,bar"] assert value == 11 end test "set" do value = 1 |> ExStatsD.set("users.ids") - assert sent == ["test.users.ids:1|s"] + assert sent() == ["test.users.ids:1|s"] assert value == 1 end test "set with tags" do value = 1 |> ExStatsD.set("users.ids", tags: ["foo", "bar"]) - assert sent == ["test.users.ids:1|s|#foo,bar"] + assert sent() == ["test.users.ids:1|s|#foo,bar"] assert value == 1 end test "histogram" do value = 42 |> ExStatsD.histogram("histogram") - assert sent == ["test.histogram:42|h"] + assert sent() == ["test.histogram:42|h"] assert value == 42 end test "histogram with tags" do value = 42 |> ExStatsD.histogram("histogram", tags: ["foo", "bar"]) - assert sent == ["test.histogram:42|h|#foo,bar"] + assert sent() == ["test.histogram:42|h|#foo,bar"] assert value == 42 end