From c430c8400f0f0cdc91f377409363f2beb194a1be Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 17 Nov 2023 13:54:53 +0100 Subject: [PATCH 1/2] Use latest truffleruby version * Older versions are not supported. --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c848e4407..e263e5d0b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -88,7 +88,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: truffleruby-22.2.0 + ruby-version: truffleruby bundler-cache: true - name: Cache local temporary directory uses: actions/cache@v3 From 2a65de5a3bf5503c1122b952a691f28f24c0a9b8 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 17 Nov 2023 13:54:18 +0100 Subject: [PATCH 2/2] Fix races in publish_subscribe_test.rb * See https://github.com/oracle/truffleruby/issues/3321 --- test/redis/publish_subscribe_test.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/redis/publish_subscribe_test.rb b/test/redis/publish_subscribe_test.rb index 79c8f7711..4deea52cc 100644 --- a/test/redis/publish_subscribe_test.rb +++ b/test/redis/publish_subscribe_test.rb @@ -177,7 +177,7 @@ def test_psubscribe_connection_usable_after_raise end def test_subscribe_within_subscribe - @channels = [] + @channels = Queue.new thread = new_thread do |r| r.subscribe(channel_name) do |on| @@ -192,7 +192,8 @@ def test_subscribe_within_subscribe thread.join - assert_equal [channel_name, "bar"], @channels + assert_equal [channel_name, "bar"], [@channels.pop, @channels.pop] + assert_empty @channels end def test_other_commands_within_a_subscribe @@ -270,8 +271,7 @@ def test_psubscribe_with_timeout def test_unsubscribe_from_another_thread @unsubscribed = @subscribed = false @subscribed_redis = nil - @messages = [] - @messages_count = 0 + @messages = Queue.new thread = new_thread do |r| @subscribed_redis = r r.subscribe(channel_name) do |on| @@ -281,7 +281,6 @@ def test_unsubscribe_from_another_thread on.message do |channel, message| @messages << [channel, message] - @messages_count += 1 end on.unsubscribe do |_channel, _total| @@ -293,8 +292,8 @@ def test_unsubscribe_from_another_thread Thread.pass until @subscribed redis.publish(channel_name, "test") - Thread.pass until @messages_count == 1 - assert_equal [channel_name, "test"], @messages.last + assert_equal [channel_name, "test"], @messages.pop + assert_empty @messages @subscribed_redis.unsubscribe # this shouldn't block refute_nil thread.join(2) @@ -302,7 +301,7 @@ def test_unsubscribe_from_another_thread end def test_subscribe_from_another_thread - @events = [] + @events = Queue.new @subscribed_redis = nil thread = new_thread do |r| r.subscribe(channel_name) do |on| @@ -339,7 +338,8 @@ def test_subscribe_from_another_thread ["unsubscribed", channel_name], ["unsubscribed", "#{channel_name}:2"] ] - assert_equal expected, @events + assert_equal(expected, expected.map { @events.pop }) + assert_empty @events end private