I have created a repo for my issue: GitHub - shawarmaz/rumbl_umbrella
At the last section of the last chapter of the Programming Phoenix 1.4 book which relate to testing channels, running mix test
raises the errors below (1)
The errors are inconsistent and sometimes I get one that says:
warning: InfoSys.Test.HTTPClient.request/1 is undefined (module InfoSys.Test.HTTPClient is not available or is yet to be defined)
lib/info_sys/wolfram.ex:4 InfoSys.Wolfram.fetch_data/1
For which I found this thread
When I run just the faulty tests using mix test apps/rumbl_web/test/rumbl_web/channels/video_channel_test.exs
I get an even more cryptic set of errors (2):
I have absolutely no idea how to approach debugging this. Any help at all would be greatly appreciated.
(1)
..................21:31:40.203 [error] Task #PID<0.651.0> started from RumblWeb.Presence_shard0 terminating
** (stop) exited in: DBConnection.Holder.checkout(#PID<0.646.0>, [log: #Function<15.17938311/1 in Ecto.Adapters.SQL.with_log/3>, source: "users", timeout: 15000, pool_size: 10, pool: DBConnection.Ownership])
** (EXIT) shutdown: "owner #PID<0.645.0> exited"
(db_connection 2.3.1) lib/db_connection/holder.ex:86: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection/holder.ex:67: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection.ex:1046: DBConnection.checkout/3
(db_connection 2.3.1) lib/db_connection.ex:1357: DBConnection.run/6
(db_connection 2.3.1) lib/db_connection.ex:613: DBConnection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:702: Ecto.Adapters.SQL.execute!/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:684: Ecto.Adapters.SQL.execute/5
(ecto 3.5.8) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.5.8) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(rumbl_web 0.1.0) lib/rumbl_web/channels/presence.ex:17: RumblWeb.Presence.fetch/2
(phoenix 1.5.8) lib/phoenix/presence.ex:365: anonymous fn/4 in Phoenix.Presence.Tracker.handle_diff/2
(stdlib 3.14) maps.erl:233: :maps.fold_1/3
(phoenix 1.5.8) lib/phoenix/presence.ex:363: anonymous fn/3 in Phoenix.Presence.Tracker.handle_diff/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.132388576/0 in Phoenix.Presence.Tracker.handle_diff/2>
Args: []
.21:31:40.221 [error] Task #PID<0.655.0> started from RumblWeb.Presence_shard0 terminating
** (stop) exited in: DBConnection.Holder.checkout(#PID<0.653.0>, [log: #Function<15.17938311/1 in Ecto.Adapters.SQL.with_log/3>, source: "users", timeout: 15000, pool_size: 10, pool: DBConnection.Ownership])
** (EXIT) shutdown: "owner #PID<0.652.0> exited"
(db_connection 2.3.1) lib/db_connection/holder.ex:86: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection/holder.ex:67: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection.ex:1046: DBConnection.checkout/3
(db_connection 2.3.1) lib/db_connection.ex:1357: DBConnection.run/6
(db_connection 2.3.1) lib/db_connection.ex:613: DBConnection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:702: Ecto.Adapters.SQL.execute!/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:684: Ecto.Adapters.SQL.execute/5
(ecto 3.5.8) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.5.8) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(rumbl_web 0.1.0) lib/rumbl_web/channels/presence.ex:17: RumblWeb.Presence.fetch/2
(phoenix 1.5.8) lib/phoenix/presence.ex:365: anonymous fn/4 in Phoenix.Presence.Tracker.handle_diff/2
(stdlib 3.14) maps.erl:233: :maps.fold_1/3
(phoenix 1.5.8) lib/phoenix/presence.ex:363: anonymous fn/3 in Phoenix.Presence.Tracker.handle_diff/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.132388576/0 in Phoenix.Presence.Tracker.handle_diff/2>
Args: []
21:31:40.224 [error] Task #PID<0.656.0> started from RumblWeb.Presence_shard0 terminating
** (stop) exited in: DBConnection.Holder.checkout(#PID<0.653.0>, [log: #Function<15.17938311/1 in Ecto.Adapters.SQL.with_log/3>, source: "users", timeout: 15000, pool_size: 10, pool: DBConnection.Ownership])
** (EXIT) shutdown: "owner #PID<0.652.0> exited"
(db_connection 2.3.1) lib/db_connection/holder.ex:86: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection/holder.ex:67: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection.ex:1046: DBConnection.checkout/3
(db_connection 2.3.1) lib/db_connection.ex:1357: DBConnection.run/6
(db_connection 2.3.1) lib/db_connection.ex:613: DBConnection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:702: Ecto.Adapters.SQL.execute!/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:684: Ecto.Adapters.SQL.execute/5
(ecto 3.5.8) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.5.8) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(rumbl_web 0.1.0) lib/rumbl_web/channels/presence.ex:17: RumblWeb.Presence.fetch/2
(phoenix 1.5.8) lib/phoenix/presence.ex:365: anonymous fn/4 in Phoenix.Presence.Tracker.handle_diff/2
(stdlib 3.14) maps.erl:233: :maps.fold_1/3
(phoenix 1.5.8) lib/phoenix/presence.ex:363: anonymous fn/3 in Phoenix.Presence.Tracker.handle_diff/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.132388576/0 in Phoenix.Presence.Tracker.handle_diff/2>
Args: []
..
Finished in 0.6 seconds
21 tests, 0 failures
Randomized with seed 876999
21:31:40.340 [error] Task #PID<0.663.0> started from RumblWeb.Presence_shard0 terminating
** (stop) exited in: DBConnection.Holder.checkout(#PID<0.658.0>, [log: #Function<15.17938311/1 in Ecto.Adapters.SQL.with_log/3>, source: "users", timeout: 15000, pool_size: 10, pool: DBConnection.Ownership])
** (EXIT) shutdown: "owner #PID<0.657.0> exited"
(db_connection 2.3.1) lib/db_connection/holder.ex:86: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection/holder.ex:67: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection.ex:1046: DBConnection.checkout/3
(db_connection 2.3.1) lib/db_connection.ex:1357: DBConnection.run/6
(db_connection 2.3.1) lib/db_connection.ex:613: DBConnection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:702: Ecto.Adapters.SQL.execute!/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:684: Ecto.Adapters.SQL.execute/5
(ecto 3.5.8) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.5.8) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(rumbl_web 0.1.0) lib/rumbl_web/channels/presence.ex:17: RumblWeb.Presence.fetch/2
(phoenix 1.5.8) lib/phoenix/presence.ex:365: anonymous fn/4 in Phoenix.Presence.Tracker.handle_diff/2
(stdlib 3.14) maps.erl:233: :maps.fold_1/3
(phoenix 1.5.8) lib/phoenix/presence.ex:363: anonymous fn/3 in Phoenix.Presence.Tracker.handle_diff/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.132388576/0 in Phoenix.Presence.Tracker.handle_diff/2>
Args: []
(2)
==> rumbl_web
..21:53:12.668 [error] Task #PID<0.449.0> started from RumblWeb.Presence_shard0 terminating
** (stop) exited in: DBConnection.Holder.checkout(#PID<0.445.0>, [log: #Function<15.17938311/1 in Ecto.Adapters.SQL.with_log/3>, source: "users", timeout: 15000, pool_size: 10, pool: DBConnection.Ownership])
** (EXIT) shutdown: "owner #PID<0.444.0> exited"
(db_connection 2.3.1) lib/db_connection/holder.ex:86: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection/holder.ex:67: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection.ex:1046: DBConnection.checkout/3
(db_connection 2.3.1) lib/db_connection.ex:1357: DBConnection.run/6
(db_connection 2.3.1) lib/db_connection.ex:613: DBConnection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:702: Ecto.Adapters.SQL.execute!/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:684: Ecto.Adapters.SQL.execute/5
(ecto 3.5.8) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.5.8) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(rumbl_web 0.1.0) lib/rumbl_web/channels/presence.ex:17: RumblWeb.Presence.fetch/2
(phoenix 1.5.8) lib/phoenix/presence.ex:365: anonymous fn/4 in Phoenix.Presence.Tracker.handle_diff/2
(stdlib 3.14) maps.erl:233: :maps.fold_1/3
(phoenix 1.5.8) lib/phoenix/presence.ex:363: anonymous fn/3 in Phoenix.Presence.Tracker.handle_diff/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.132388576/0 in Phoenix.Presence.Tracker.handle_diff/2>
Args: []
21:53:12.668 [error] Task #PID<0.448.0> started from RumblWeb.Presence_shard0 terminating
** (stop) exited in: DBConnection.Holder.checkout(#PID<0.445.0>, [log: #Function<15.17938311/1 in Ecto.Adapters.SQL.with_log/3>, source: "users", timeout: 15000, pool_size: 10, pool: DBConnection.Ownership])
** (EXIT) shutdown: "owner #PID<0.444.0> exited"
(db_connection 2.3.1) lib/db_connection/holder.ex:86: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection/holder.ex:67: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection.ex:1046: DBConnection.checkout/3
(db_connection 2.3.1) lib/db_connection.ex:1357: DBConnection.run/6
(db_connection 2.3.1) lib/db_connection.ex:613: DBConnection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:702: Ecto.Adapters.SQL.execute!/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:684: Ecto.Adapters.SQL.execute/5
(ecto 3.5.8) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.5.8) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(rumbl_web 0.1.0) lib/rumbl_web/channels/presence.ex:17: RumblWeb.Presence.fetch/2
(phoenix 1.5.8) lib/phoenix/presence.ex:365: anonymous fn/4 in Phoenix.Presence.Tracker.handle_diff/2
(stdlib 3.14) maps.erl:233: :maps.fold_1/3
(phoenix 1.5.8) lib/phoenix/presence.ex:363: anonymous fn/3 in Phoenix.Presence.Tracker.handle_diff/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.132388576/0 in Phoenix.Presence.Tracker.handle_diff/2>
Args: []
21:53:12.666 [error] Task #PID<0.443.0> started from RumblWeb.Presence_shard0 terminating
** (stop) exited in: DBConnection.Holder.checkout(#PID<0.439.0>, [log: #Function<15.17938311/1 in Ecto.Adapters.SQL.with_log/3>, source: "users", timeout: 15000, pool_size: 10, pool: DBConnection.Ownership])
** (EXIT) shutdown: "owner #PID<0.438.0> exited"
(db_connection 2.3.1) lib/db_connection/holder.ex:86: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection/holder.ex:67: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection.ex:1046: DBConnection.checkout/3
(db_connection 2.3.1) lib/db_connection.ex:1357: DBConnection.run/6
(db_connection 2.3.1) lib/db_connection.ex:613: DBConnection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:702: Ecto.Adapters.SQL.execute!/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:684: Ecto.Adapters.SQL.execute/5
(ecto 3.5.8) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.5.8) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(rumbl_web 0.1.0) lib/rumbl_web/channels/presence.ex:17: RumblWeb.Presence.fetch/2
(phoenix 1.5.8) lib/phoenix/presence.ex:365: anonymous fn/4 in Phoenix.Presence.Tracker.handle_diff/2
(stdlib 3.14) maps.erl:233: :maps.fold_1/3
(phoenix 1.5.8) lib/phoenix/presence.ex:363: anonymous fn/3 in Phoenix.Presence.Tracker.handle_diff/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.132388576/0 in Phoenix.Presence.Tracker.handle_diff/2>
Args: []
21:53:12.663 [error] Task #PID<0.446.0> started from #PID<0.442.0> terminating
** (UndefinedFunctionError) function InfoSys.Test.HTTPClient.request/1 is undefined (module InfoSys.Test.HTTPClient is not available)
InfoSys.Test.HTTPClient.request('http://api.wolframalpha.com/v2/query?appid=1234&input=the+body&format=plaintext')
(info_sys 0.1.0) lib/info_sys/wolfram.ex:32: InfoSys.Wolfram.fetch_xml/1
(info_sys 0.1.0) lib/info_sys/wolfram.ex:18: InfoSys.Wolfram.compute/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(elixir 1.11.3) lib/task/supervised.ex:35: Task.Supervised.reply/5
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: &InfoSys.Wolfram.compute/2
Args: ["the body", [limit: 1, timeout: 10000]]
21:53:12.699 [error] Task #PID<0.455.0> started from #PID<0.454.0> terminating
** (UndefinedFunctionError) function InfoSys.Test.HTTPClient.request/1 is undefined (module InfoSys.Test.HTTPClient is not available)
InfoSys.Test.HTTPClient.request('http://api.wolframalpha.com/v2/query?appid=1234&input=1+%2B+1&format=plaintext')
(info_sys 0.1.0) lib/info_sys/wolfram.ex:32: InfoSys.Wolfram.fetch_xml/1
(info_sys 0.1.0) lib/info_sys/wolfram.ex:18: InfoSys.Wolfram.compute/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(elixir 1.11.3) lib/task/supervised.ex:35: Task.Supervised.reply/5
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: &InfoSys.Wolfram.compute/2
Args: ["1 + 1", [limit: 1, timeout: 10000]]
21:53:12.802 [error] Task #PID<0.456.0> started from RumblWeb.Presence_shard0 terminating
** (stop) exited in: DBConnection.Holder.checkout(#PID<0.451.0>, [log: #Function<15.17938311/1 in Ecto.Adapters.SQL.with_log/3>, source: "users", timeout: 15000, pool_size: 10, pool: DBConnection.Ownership])
** (EXIT) shutdown: "owner #PID<0.450.0> exited"
(db_connection 2.3.1) lib/db_connection/holder.ex:86: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection/holder.ex:67: DBConnection.Holder.checkout/2
(db_connection 2.3.1) lib/db_connection.ex:1046: DBConnection.checkout/3
(db_connection 2.3.1) lib/db_connection.ex:1357: DBConnection.run/6
(db_connection 2.3.1) lib/db_connection.ex:613: DBConnection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:702: Ecto.Adapters.SQL.execute!/4
(ecto_sql 3.5.4) lib/ecto/adapters/sql.ex:684: Ecto.Adapters.SQL.execute/5
(ecto 3.5.8) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.5.8) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(rumbl_web 0.1.0) lib/rumbl_web/channels/presence.ex:17: RumblWeb.Presence.fetch/2
(phoenix 1.5.8) lib/phoenix/presence.ex:365: anonymous fn/4 in Phoenix.Presence.Tracker.handle_diff/2
(stdlib 3.14) maps.erl:233: :maps.fold_1/3
(phoenix 1.5.8) lib/phoenix/presence.ex:363: anonymous fn/3 in Phoenix.Presence.Tracker.handle_diff/2
(elixir 1.11.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.132388576/0 in Phoenix.Presence.Tracker.handle_diff/2>
Args: []
1) test new annotations trigger InfoSys (RumblWeb.Channels.VideoChannelTest)
apps/rumbl_web/test/rumbl_web/channels/video_channel_test.exs:33
Assertion failed, no matching message after 100ms
Showing 4 of 4 messages in the mailbox
code: assert_receive %Phoenix.Socket.Broadcast{event: "new_annotation", payload: %{body: "2", at: 123}}
mailbox:
pattern: %Phoenix.Socket.Broadcast{
event: "new_annotation",
payload: %{at: 123, body: "2"}
}
value: %Phoenix.Socket.Message{
event: "presence_state",
payload: %{},
join_ref: 1253,
ref: nil,
topic: "videos:568"
}
pattern: %Phoenix.Socket.Broadcast{
event: "new_annotation",
payload: %{at: 123, body: "2"}
}
value: %Phoenix.Socket.Broadcast{
event: "presence_diff",
payload: %{
joins: %{"973" => %{metas: [%{device: "browser", phx_ref: "Fm9y9iEWCVienQEC"}], user: %{username: "user1125"}}},
leaves: %{}
},
topic: "videos:568"
}
pattern: %Phoenix.Socket.Broadcast{
event: "new_annotation",
payload: %{at: 123, body: "2"}
}
value: %Phoenix.Socket.Message{
event: "presence_diff",
payload: %{
joins: %{"973" => %{metas: [%{device: "browser", phx_ref: "Fm9y9iEWCVienQEC"}], user: %{username: "user1125"}}},
leaves: %{}
},
join_ref: nil,
ref: nil,
topic: "videos:568"
}
pattern: %Phoenix.Socket.Broadcast{
event: "new_annotation",
payload: %{at: 123, body: "2"}
}
value: %Phoenix.Socket.Message{
event: "new_annotation",
payload: %{
at: 123,
body: "1 + 1",
id: 134,
user: %{id: 973, username: "user1125"}
},
join_ref: nil,
ref: nil,
topic: "videos:568"
}
stacktrace:
test/rumbl_web/channels/video_channel_test.exs:43: (test)
Finished in 0.3 seconds
3 tests, 1 failure
Randomized with seed 409577