Jac*_*sle 8 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
Run Code Online (Sandbox Code Playgroud)
几个月内没有对测试配置的更改......
# 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
Run Code Online (Sandbox Code Playgroud)
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)"
}
}
Run Code Online (Sandbox Code Playgroud)
}
与Phoenix 1.3一起运行.
我想知道是否有人在星期一早上面对这个问题,或者是否有人有任何建议?
提前致谢!
将 mix_env 设置为在您的设置和测试脚本中进行测试:
"scripts": {
"test-setup": "MIX_ENV=test mix ecto.migrate",
"test": "MIX_ENV=test mix test"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
108 次 |
| 最近记录: |