{"action":"created","issue":{"url":"https://api.github.com/repos/thoughtbot/ex_machina/issues/150","repository_url":"https://api.github.com/repos/thoughtbot/ex_machina","labels_url":"https://api.github.com/repos/thoughtbot/ex_machina/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/thoughtbot/ex_machina/issues/150/comments","events_url":"https://api.github.com/repos/thoughtbot/ex_machina/issues/150/events","html_url":"https://github.com/thoughtbot/ex_machina/issues/150","id":167229272,"number":150,"title":"Test suite hangs - db connection timeout","user":{"login":"iammac360","id":786083,"avatar_url":"https://avatars.githubusercontent.com/u/786083?v=3","gravatar_id":"","url":"https://api.github.com/users/iammac360","html_url":"https://github.com/iammac360","followers_url":"https://api.github.com/users/iammac360/followers","following_url":"https://api.github.com/users/iammac360/following{/other_user}","gists_url":"https://api.github.com/users/iammac360/gists{/gist_id}","starred_url":"https://api.github.com/users/iammac360/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iammac360/subscriptions","organizations_url":"https://api.github.com/users/iammac360/orgs","repos_url":"https://api.github.com/users/iammac360/repos","events_url":"https://api.github.com/users/iammac360/events{/privacy}","received_events_url":"https://api.github.com/users/iammac360/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-24T11:30:09Z","updated_at":"2016-10-20T15:39:23Z","closed_at":"2016-07-29T15:17:03Z","body":"Hi, whenever I run my phoenix tests that uses an ex_machina factory, it always hangs, I'm not sure if I configured it properly but I followed what's on the README section on how to set it up.. \r\n\r\nHere's the error that I always get: \r\n\r\n```\r\n☻  mix test test/models/petc_user_test.exs                                                                                                                                                                                                               2.3.1 master 1bd1653 ✗\r\nCompiling 19 files (.ex)\r\nGenerated mxn_machine app\r\nwarning: unused alias TestingCenter\r\n  test/models/petc_user_test.exs:3\r\n\r\n....19:18:29.045 [error] Postgrex.Protocol (#PID<0.399.0>) disconnected: ** (DBConnection.ConnectionError) owner #PID<0.442.0> timed out because it owned the connection for longer than 15000ms\r\n\r\n\r\n  1) test changeset with existing email address (MxnMachine.PetcUserTest)\r\n     test/models/petc_user_test.exs:36\r\n     ** (ExUnit.TimeoutError) test timed out after 60000ms. You can change the timeout:\r\n\r\n       1. per test by setting \"@tag timeout: x\"\r\n       2. per case by setting \"@moduletag timeout: x\"\r\n       3. globally via \"ExUnit.start(timeout: x)\" configuration\r\n       4. or set it to infinity per run by calling \"mix test --trace\"\r\n          (useful when using IEx.pry)\r\n\r\n     Timeouts are given as integers in milliseconds.\r\n\r\n     stacktrace:\r\n       (elixir) lib/code.ex:525: Code.ensure_loaded?/1\r\n       (ex_machina) lib/ex_machina.ex:135: ExMachina.build/3\r\n       (mxn_machine) test/support/factory.ex:22: MxnMachine.Factory.petc_machine_factory/0\r\n       (ex_machina) lib/ex_machina.ex:136: ExMachina.build/3\r\n       (mxn_machine) test/support/factory.ex:11: MxnMachine.Factory.testing_center_factory/0\r\n       (ex_machina) lib/ex_machina.ex:136: ExMachina.build/3\r\n       (mxn_machine) test/support/factory.ex:22: MxnMachine.Factory.petc_machine_factory/0\r\n       (ex_machina) lib/ex_machina.ex:136: ExMachina.build/3\r\n\r\n\r\n\r\nFinished in 60.6 seconds\r\n5 tests, 1 failure\r\n\r\nRandomized with seed 613094\r\n```\r\n\r\nand here's the snippet of my test using the factory:\r\n\r\n```\r\n  test \"changeset with existing email address\" do\r\n    tc = insert(:testing_center)\r\n    attrs = @valid_attrs |> Map.put(:testing_center_id, tc.id)\r\n    insert(:petc_user, attrs)\r\n\r\n    # Use the same attributes to simulate existing email being registered again\r\n    changeset = PetcUser.changeset(%PetcUser{}, attrs)\r\n    assert {:error, changeset} = Repo.insert(changeset)\r\n    \r\n    refute changeset.valid?\r\n    assert Dict.has_key?(changeset.errors, :email)\r\n    assert elem(changeset.errors[:email], 0) == \"has already been taken\"\r\n  end\r\n\r\n  test \"changeset with invalid attributes\" do\r\n    changeset = PetcUser.changeset(%PetcUser{}, @invalid_attrs)\r\n    refute changeset.valid?\r\n  end\r\n```\r\n\r\nBy the way, I'm still an elixir noob with a ruby, node and golang background and I have been playing phoenix and elixir for atleast 3 days now and I've been loving it eversince I started playing with it haha!!. I'm currently learning how to write tests using ExUnit. Hope someone guide me on this. Thanks!!"},"comment":{"url":"https://api.github.com/repos/thoughtbot/ex_machina/issues/comments/255143199","html_url":"https://github.com/thoughtbot/ex_machina/issues/150#issuecomment-255143199","issue_url":"https://api.github.com/repos/thoughtbot/ex_machina/issues/150","id":255143199,"user":{"login":"P4l","id":6576951,"avatar_url":"https://avatars.githubusercontent.com/u/6576951?v=3","gravatar_id":"","url":"https://api.github.com/users/P4l","html_url":"https://github.com/P4l","followers_url":"https://api.github.com/users/P4l/followers","following_url":"https://api.github.com/users/P4l/following{/other_user}","gists_url":"https://api.github.com/users/P4l/gists{/gist_id}","starred_url":"https://api.github.com/users/P4l/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/P4l/subscriptions","organizations_url":"https://api.github.com/users/P4l/orgs","repos_url":"https://api.github.com/users/P4l/repos","events_url":"https://api.github.com/users/P4l/events{/privacy}","received_events_url":"https://api.github.com/users/P4l/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T15:39:23Z","updated_at":"2016-10-20T15:39:23Z","body":"Hi @iammac360 did you find a solution for this you might want to share? I'm having the same errors."}}
{"actor":{"display_login":"P4l"}}