Add a regression test for per-fiber tagged logging

Followup to 978421abd83d45b72e299f50a4fb324fcbdb3e00.
This commit is contained in:
Eugene Kenny 2020-07-02 22:37:23 +01:00
parent c3913e580c
commit 19d8578361
1 changed files with 9 additions and 0 deletions

View File

@ -83,6 +83,15 @@ class TaggedLoggingTest < ActiveSupport::TestCase
assert_equal "Dull story\n[OMG] Cool story\n[BCX] Funky time\n", @output.string
end
test "keeps each tag in their own thread even when pushed directly" do
Thread.new do
@logger.push_tags("OMG")
@logger.info "Cool story"
end.join
@logger.info "Funky time"
assert_equal "[OMG] Cool story\nFunky time\n", @output.string
end
test "keeps each tag in their own instance" do
other_output = StringIO.new
other_logger = ActiveSupport::TaggedLogging.new(MyLogger.new(other_output))