Get $50+ off for Black Friday!

We've moved discussions to Discord

Test Runner on Github

Rob Bazinet •
I'm wondering if anyone has tests running locally but failing on Github? 

My tests all run fine but keep failing on Github...any ideas? I can post a stack trace here if it will help. I've looked at it but I must be missing something.

The runner fails after running for 4 seconds. Here is the initial part of the stack trace:

Run bin/rails db:test:prepare
/home/runner/work/docbuilder/docbuilder/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/runner/work/docbuilder/docbuilder/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method `add_modifier' is defined here
rails aborted!

I run this locally and it works fine. 

Thanks,
     Rob
Chris Oliver •
The Postgres image now requires a password and I know I updated the CI stuff recently to include that. 

I just ran tests on GitHub Actions a minute ago to deploy updates for the marketing site and it's passing with no changes.
Rob Bazinet •
I knew you'd say that. It works on your machine. :-)

Suggestions then? I have all the latest changes, including todays and pushed but the tests are failing. It seems as soon as it tries to prepare the DB.
Chris Oliver •
There's no other error information?

Does the command work locally?
Rob Bazinet •
Yes, it works fine locally..the command and the tests. I just must be missing something obvious. I don't see the master key in there but I don't know if that shows on these runners or not.

Here is more of the error:

Run bin/rails db:test:prepare
  bin/rails db:test:prepare
  bin/rails test
  shell: /bin/bash -e {0}
  env:
    PATH: /home/runner/.rubies/ruby-2.7.0/bin:/usr/share/rust/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
    DATABASE_URL: postgres://postgres:password@localhost:5432/test
    REDIS_URL: redis://localhost:6379/0
    RAILS_ENV: test
    RAILS_MASTER_KEY: 
    PG_USER: postgres
/home/runner/work/docbuilder/docbuilder/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/runner/work/docbuilder/docbuilder/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method `add_modifier' is defined here
rails aborted!
ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
/home/runner/work/docbuilder/docbuilder/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
/home/runner/work/docbuilder/docbuilder/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/message_encryptor.rb:183:in `_decrypt'
/home/runner/work/docbuilder/docbuilder/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
/home/runner/work/docbuilder/docbuilder/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
Chris Oliver •
Ah, you missed this part:

ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage

Which means you're missing the RAILS_MASTER_KEY env var in Actions I bet.
Rob Bazinet •
Yeah, well when I copied and pasted RAILS_MASTER_KEY, I only had RAILS_MASTER_KE. Duh!

I knew there had to be something easy but assuming it was in there, and when I double-checked I only looked at the key itself. 

So, just like the key wasn't in there. Tests are passing now in Github.

Thanks Chris, as usual. 
Chris Oliver •
Doh, that'd stump me too. 🤪
Notifications
You’re not receiving notifications from this thread.