I had an issue where the recently added “Check SKIP_DB_AND_REDIS bootability” step failed for one of my plugins.
SKIP_DB_AND_REDIS boot failed. Make sure the database is not being accessed during the Rails boot process.
To reproduce locally, run `SKIP_DB_AND_REDIS=1 RAILS_DB=‘nonexistent’ bin/rails runner “puts ‘booted successfully’”`.
I tried that, but I could not reproduce the problem locally. It just passed.
I could use the stack trace of the failing github action step to nail down what code was the culprit.
The offending code
In one of my controllers I declared a constant which retrieved the list of attributes of an active record:
REWARD_FIELDS = Reward.attribute_names.excluding("id", "created_at", "updated_at")
Which you apparently should not do.
But it would have been nicer if I could simulate this check locally, so I do not have to doe some trial an error via github actions. So there must be something else besides executing:
SKIP_DB_AND_REDIS=1 RAILS_DB='nonexistent' bin/rails runner "puts 'booted successfully'"