Run rake spec in parallel

By chance has anyone already running the rake spec tasks in parallel?

1 Like

We run our tests in parallel during CI, and also during local development. To try it out, you can run:

bin/rake parallel:create
bin/rake parallel:migrate
bin/turbo_rspec
7 Likes

Thank you, this is pretty cool!

To make it run in my local dev environment I first had to fix:

ERROR: permission denied to create database
Tasks: TOP => db:create
(See full trace by running task with --trace)
PG::InsufficientPrivilege: ERROR:  permission denied to create database
Couldn't create 'discourse_test_32' database. Please check your configuration.
rake aborted!
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR:  permission denied to create database

Caused by:
PG::InsufficientPrivilege: ERROR:  permission denied to create database
# switch into container
d/shell_root

# inside container - root@discourse:/#
sudo -u postgres psql

# psql - postgres=#
ALTER USER discourse CREATEDB;
exit

# inside container - root@discourse:/#
exit

And now it works even inside the container:

d/rake parallel:create
d/rake parallel:migrate
d/exec bin/turbo_rspec

Finished in 3 minutes 11.6 seconds (files took 0 seconds to load) :rocket:
16015 examples, 12 failures, 10 pending, 3 errors occurred outside of examples

3 Likes