Heroku测试在一夜之间开始失败? (无法配置沙箱)

时间:2018-04-24 14:29:28

标签: testing heroku elixir phoenix-framework

当我在Heroku上进行测试时发生了一个奇怪的错误,周五没有发生,一切都很好。

-----> Running test command `mix test`...
  08:29:52.761 [info] Already up
  08:29:53.389 [info] seeding in prod environment
  08:29:53.389 [info] runing default seeds
  All departments inserted

  ** (RuntimeError) cannot configure sandbox with pool DBConnection.Poolboy.
  To use the SQL Sandbox, configure your repository pool as:
  pool: Ecto.Adapters.SQL.Sandbox
  (ecto) lib/ecto/adapters/sql/sandbox.ex:429: Ecto.Adapters.SQL.Sandbox.mode/2
  (elixir) lib/code.ex:376: Code.require_file/2
  (elixir) lib/enum.ex:675: Enum."-each/2-lists^foreach/1-0-"/2
  (elixir) lib/enum.ex:675: Enum.each/2
  (mix) lib/mix/tasks/test.ex:229: Mix.Tasks.Test.run/1
-----> test command `mix test` failed with exit status 1

几个月内测试配置没有变化......

# Configure your database
config :ev2, Ev2.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "postgres",
  password: "postgres",
  database: "ev2_timecards_test",
  hostname: "localhost",
  pool: Ecto.Adapters.SQL.Sandbox

app.json目前看起来像这样:

"environments": {
"test": {
  "env": {
    "IS_STAGING": {
      "required": false
    }
  },
  "addons":[
    "heroku-postgresql:hobby-dev",
    "heroku-redis:hobby-dev"
  ],
  "scripts": {
    "test-setup": "mix ecto.migrate",
    "test": "mix test",
    "postdeploy": "bash <(curl -s https://codecov.io/bash)"
  }
}

}

使用Phoenix 1.3运行。

我想知道是否有人在星期一早上面对这个问题,或者是否有人有任何建议?

提前致谢!

1 个答案:

答案 0 :(得分:2)

在您的设置和测试脚本中将mix_env设置为test:

      "scripts": {
        "test-setup": "MIX_ENV=test mix ecto.migrate",
        "test": "MIX_ENV=test mix test"
      }