parroty / excoveralls

Coverage report tool for Elixir with coveralls.io integration.
MIT License
824 stars 179 forks source link

SQL Sandbox Mode #69

Open AndrewDryga opened 8 years ago

AndrewDryga commented 8 years ago

Is there any way to turn SQL Sandbox Mode on when running coveralls? (We use it on Travis-CI.)

$ mix coveralls.travis --pro
............
Finished in 6.3 seconds
12 tests, 0 failures
Randomized with seed 398467
17:29:59.943 [error] GenServer #PID<0.637.0> terminating
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.637.0>.
When using ownership, you must manage connections in one
of the three ways:
  * By explicitly checking out a connection
  * By explicitly allowing a spawned process
  * By running the pool in shared mode
The first two options require every new process to explicitly
check a connection out or be allowed by calling checkout or
allow respectively.
The third option requires a {:shared, pid} mode to be set.
If using shared mode in tests, make sure your tests are not
async.
If you are reading this error, it means you have not done one
of the steps above or that the owner process has crashed.
See Ecto.Adapters.SQL.Sandbox docs for more information.
    (db_connection) lib/db_connection.ex:718: DBConnection.checkout/2
    (db_connection) lib/db_connection.ex:619: DBConnection.run/3
    (db_connection) lib/db_connection.ex:463: DBConnection.prepare_execute/4
    (ecto) lib/ecto/adapters/postgres/connection.ex:82: Ecto.Adapters.Postgres.Connection.execute/4
    (ecto) lib/ecto/adapters/sql.ex:228: Ecto.Adapters.SQL.sql_call/6
    (ecto) lib/ecto/adapters/sql.ex:426: Ecto.Adapters.SQL.struct/6
    (ecto) lib/ecto/repo/schema.ex:391: Ecto.Repo.Schema.apply/4
    (ecto) lib/ecto/repo/schema.ex:187: anonymous fn/11 in Ecto.Repo.Schema.do_insert/4
    (ap_api) lib/parser/batch_parser.ex:45: AssetProcessor.Parser.process_loan/1
    (bsoneach) lib/bsoneach.ex:121: BSONEach.apply_callback/2
    (bsoneach) lib/bsoneach.ex:77: BSONEach.iterate/4
    (bsoneach) lib/bsoneach.ex:50: BSONEach.each/2
    (ap_api) lib/parser/batch_parser.ex:30: AssetProcessor.Parser.handle_info/2
    (stdlib) gen_server.erl:601: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:667: :gen_server.handle_msg/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
17:30:00.033 [error] GenServer #PID<0.655.0> terminating
xadhoom commented 6 years ago

this does not relate to coveralls, I use it in travis and gitlab-cli without any issue.

check you mix project settings and check that you have

      preferred_cli_env: [
        "coveralls": :test, "coveralls.detail": :test,
        "coveralls.post": :test, "coveralls.html": :test
      ]
Ch4s3 commented 5 years ago

I'm running into this as well with the following config

  def project do
    [
      app: :my_app,
      version: "0.0.1",
      elixir: "~> 1.7.3",
      elixirc_paths: elixirc_paths(Mix.env()),
      compilers: [:phoenix, :gettext] ++ Mix.compilers(),
      start_permanent: Mix.env() == :prod,
      aliases: aliases(),
      deps: deps(),
      test_coverage: [tool: ExCoveralls],
      preferred_cli_env: [
        coveralls: :test,
        "coveralls.detail": :test,
        "coveralls.post": :test,
        "coveralls.html": :test
      ],
      name: "MyApp",
      source_url: "https://repo.example/myrepo",
      docs: [
        main: "readme",
        extras: ["README.md"]
      ]
    ]
  end

and the following error

16:03:19.027 [error] GenServer MyApp.MyModule.MyGenserver terminating
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.709.0>.