From 136b7b4a0698ea67481771ccb89e2e1743933e1f Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Tue, 14 Oct 2025 09:34:02 -0400 Subject: [PATCH 1/6] Only test modern Ruby --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a31734f6..a077c604 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,7 @@ jobs: strategy: matrix: ruby: - - '2.5' # earliest supported - - '3.0' # latest release + - '3.4' # latest release steps: - run: | From 448c48a3cf859767c2afac5247d0d66046d10b88 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Tue, 14 Oct 2025 09:37:37 -0400 Subject: [PATCH 2/6] Update all the gems --- Gemfile.lock | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 67254cd1..fd4fa5a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,30 +6,46 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (6.1.3.1) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (8.0.3) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) - concurrent-ruby (1.1.8) - dalli (2.7.11) - i18n (1.8.10) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + base64 (0.3.0) + benchmark (0.4.1) + bigdecimal (3.3.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.4) + dalli (3.2.8) + drb (2.2.3) + i18n (1.14.7) concurrent-ruby (~> 1.0) + logger (1.7.0) memcache-client (1.8.5) - minitest (5.14.4) - mocha (1.12.0) - power_assert (2.0.0) - rake (13.0.3) - rake-compiler (1.1.1) + minitest (5.26.0) + mocha (2.7.1) + ruby2_keywords (>= 0.0.5) + power_assert (2.0.5) + rake (13.3.0) + rake-compiler (1.3.0) rake remix-stash (1.1.3) - stackprof (0.2.17) - test-unit (3.4.0) + ruby2_keywords (0.0.5) + securerandom (0.4.1) + stackprof (0.2.27) + test-unit (3.7.0) power_assert - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - zeitwerk (2.4.2) + uri (1.0.4) PLATFORMS ruby @@ -47,4 +63,4 @@ DEPENDENCIES test-unit BUNDLED WITH - 2.1.4 + 2.7.2 From 42023c6d771a7fbee83b9cb528a9e52be853ab9d Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Tue, 14 Oct 2025 10:10:32 -0400 Subject: [PATCH 3/6] Don't kill memcached in ci --- test/setup.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/setup.rb b/test/setup.rb index fb5bd237..b5f94262 100644 --- a/test/setup.rb +++ b/test/setup.rb @@ -4,7 +4,9 @@ UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','memcached') # Kill memcached - system("killall -9 memcached") + unless ENV['CI'] + system("killall -9 memcached") + end # Start memcached verbosity = (ENV['DEBUG'] ? "-vv" : "") From 973896735da233a303db8a60a9e2ca3a171fe90b Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Tue, 14 Oct 2025 10:13:24 -0400 Subject: [PATCH 4/6] Declare ostruct dep --- Gemfile | 1 + Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 0590916d..670cd4f9 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ gemspec gem 'test-unit' gem "stackprof" +gem "ostruct" group :benchmark do gem "remix-stash", '~> 1.1.3' diff --git a/Gemfile.lock b/Gemfile.lock index fd4fa5a9..ddb97084 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,6 +33,7 @@ GEM minitest (5.26.0) mocha (2.7.1) ruby2_keywords (>= 0.0.5) + ostruct (0.6.3) power_assert (2.0.5) rake (13.3.0) rake-compiler (1.3.0) @@ -56,6 +57,7 @@ DEPENDENCIES memcache-client memcached! mocha + ostruct rake rake-compiler remix-stash (~> 1.1.3) From bc07f3d931302194257b7ec1420a6d438d523454 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Tue, 14 Oct 2025 10:41:25 -0400 Subject: [PATCH 5/6] Update deprecated mocha expectation --- test/unit/rails_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/rails_test.rb b/test/unit/rails_test.rb index b83058e0..55c8b96f 100644 --- a/test/unit/rails_test.rb +++ b/test/unit/rails_test.rb @@ -236,7 +236,7 @@ def test_fetch assert_equal @value, @cache.fetch("x"){ 1 } # works with options - @cache.expects(:write).with("y", 1, :foo => :bar) + @cache.expects(:write).with("y", 1, {:foo => :bar}) @cache.fetch("y", :foo => :bar){ 1 } end From 0076f94bbe6d1be920dc296f14df98763847a769 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Tue, 14 Oct 2025 10:12:35 -0400 Subject: [PATCH 6/6] Get tests passing These were failing because they relied on caller locations for keys and those changed between Ruby versions --- test/unit/memcached_experimental_test.rb | 2 +- test/unit/memcached_test.rb | 6 +++--- test/unit/rails_test.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/unit/memcached_experimental_test.rb b/test/unit/memcached_experimental_test.rb index da72a36d..affcae29 100644 --- a/test/unit/memcached_experimental_test.rb +++ b/test/unit/memcached_experimental_test.rb @@ -100,7 +100,7 @@ def test_reset private def key - caller.first[/.*[` ](.*)'/, 1] # ' + caller.first[/.*[`' ](.*)'/, 1] # ' end def stub_server(port) diff --git a/test/unit/memcached_test.rb b/test/unit/memcached_test.rb index 39702c07..ff3e366f 100644 --- a/test/unit/memcached_test.rb +++ b/test/unit/memcached_test.rb @@ -422,7 +422,7 @@ def test_get_multi_missing @cache.set "#{key}_3", 3 @cache.delete "#{key}_4" rescue nil assert_equal( - {"test_get_multi_missing_3"=>3, "test_get_multi_missing_1"=>1}, + {"#{key}_3"=>3, "#{key}_1"=>1}, @cache.get(["#{key}_1", "#{key}_2", "#{key}_3", "#{key}_4"]) ) end @@ -432,7 +432,7 @@ def test_get_multi_binary @binary_protocol_cache.delete "#{key}_2" rescue nil @binary_protocol_cache.set "#{key}_3", 3 assert_equal( - {"test_get_multi_binary_3"=>3, "test_get_multi_binary_1"=>1}, + {"#{key}_3"=>3, "#{key}_1"=>1}, @binary_protocol_cache.get(["#{key}_1", "#{key}_2", "#{key}_3"]) ) end @@ -1582,7 +1582,7 @@ def interrupt_test_with_options(key, options) end def key - caller.first[/.*[` ](.*)'/, 1] # ' + caller.first[/.*[`' ](.*)'/, 1] # ' end def stub_server(port) diff --git a/test/unit/rails_test.rb b/test/unit/rails_test.rb index 55c8b96f..7748650e 100644 --- a/test/unit/rails_test.rb +++ b/test/unit/rails_test.rb @@ -325,7 +325,7 @@ def test_write_with_nil_options private def key - caller.first[/.*[` ](.*)'/, 1] # ' + caller.first[/.*[`' ](.*)'/, 1] # ' end def compare_servers(cache, servers)