Skip to content

Commit

Permalink
add small test
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellhenke committed Nov 14, 2018
1 parent fd7b299 commit 4e0d99c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/scout_apm/instruments_ecto_logger_test.exs
@@ -0,0 +1,27 @@
defmodule ScoutApm.Instruments.EctoLoggerTest do
use ExUnit.Case, async: false

describe "record/1" do
test "successfully records query" do
entry = %{
decode_time: 16000,
query_time: 1192999,
queue_time: 36000,
result: {:ok, %{__struct__: Postgrex.Result, command: :select}},
source: "users",
query: "SELECT u0.\"id\", u0.\"name\", u0.\"age\" FROM \"users\" AS u0",
}

ScoutApm.TrackedRequest.start_layer("Controller", "test")
ScoutApm.Instruments.EctoLogger.record(entry)
assert %{
children: [[
%{
name: "select#users",
type: "Ecto",
}
]]
} = Process.get(:scout_apm_request)
end
end
end

0 comments on commit 4e0d99c

Please sign in to comment.