logidze: latest release (v0.10.0) breaks db tests

Tell us about your environment

Ruby Version: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]

Rails Version: Rails 6.0.0.rc1

PostgreSQL Version: PostgreSQL 10.6 on x86_64-pc-linux-musl, compiled by gcc (Alpine 8.2.0) 8.2.0, 64-bit

Logidze Version: v0.10.0

What did you do?

Running tests that rely on test fixtures caused a bunch of failures that were seemingly unrelated to the tests being ran.

What did you expect to happen?

Tests would continue to pass.

What actually happened?

I have a feeling that this may be related to parallel tests and Rails stock test fixtures.

I kept my app on v0.9.0 and also got some recent console errors while trying to set a responsible_id in an ActiveJob. The error output was WARNING: SET LOCAL can only be used in transaction blocks

I realize this isn’t a very actionable error, but wanted to bring it up in case others ran into something similar. Feel free to close if it’s not helpful.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

It works! 🎉 All tests are passing with latest master: 7d5c33e

Awesome job!

For setting responsible_id in tests, I enqueue the job with the user’s ID as a param:

class SomeJob < ApplicationJob
  queue_as :default

  def perform(responsible_id, other, things)
    Logidze.with_responsible(responsible_id) do
      api = DoStuff(other, thing)
      api.create_or_update_user!(user)
    end
  end
end

I am using stock Rails tests with fixtures.

You are correct that my app’s tests passed in v0.9.0 and started to fail in v0.10.0. I will take a look at your log suggestion tomorrow and come back with some more info.