Making Heroku CI (almost) as fast as running Rspec locally
Once Heroku support showed us how to specify the Postgres version for in-dyno Postgres in our app.json we re-ran our Rspec rspecs and were pleasantly surprised how fast they ran. (Specifying Postgres 9.6 seems to be required for Rspec for a Rails 4.2.11 app; using the default Postgres 10 causes errors related to the change of the increment_by field in P 10)
[table id=2 /]
The “trick” to specifying the Postgres version for in-dyno Postgres is to use an environment variable. If this is documented anywhere we could not find it, so perhaps this will be helpful to someone else:
In order to change the Postgres version for the in-dyno add-on you'll need to create a new environment variable in your app.json like this:
"environments": {
"test": {
"addons": ["heroku-postgresql:in-dyno"],
"env": {
"POSTGRESQL_VERSION": {
"value": "9.6"
}
}
}
}
}