From 78285a674f9ce953c1f64c521667c7fea66e4ed8 Mon Sep 17 00:00:00 2001 From: Dan Manges Date: Mon, 19 Feb 2024 17:05:05 -0500 Subject: [PATCH] Test with Ruby 3.2 and 3.3 (#120) --- .github/workflows/ci.yml | 3 +++ bin/check_num_tests.rb | 2 +- spec/features/integration_spec.rb | 1 + spec/rspec/abq_spec.rb | 8 ++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6861bcae..c1396a4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,10 +28,13 @@ jobs: rspec-matrix: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: ruby: - '3.0' - '3.1' + - '3.2' + - '3.3' gemfile: - '3.8' - '3.9' diff --git a/bin/check_num_tests.rb b/bin/check_num_tests.rb index 6087647d..2891ec00 100755 --- a/bin/check_num_tests.rb +++ b/bin/check_num_tests.rb @@ -9,7 +9,7 @@ EXPECTED_TEST_NUMBER_SNAPSHOT_PATH = 'spec/NUM_TESTS' json_path = ARGV[0] || DEFAULT_TEST_JSON_PATH -unless File.exists?(json_path) +unless File.exist?(json_path) warn "no test file found at #{json_path}" warn "usage: bin/snapshot_num_tests.rb (path to json file) (default: #{DEFAULT_TEST_JSON_PATH}" exit 1 diff --git a/spec/features/integration_spec.rb b/spec/features/integration_spec.rb index c748ec74..e9360038 100644 --- a/spec/features/integration_spec.rb +++ b/spec/features/integration_spec.rb @@ -135,6 +135,7 @@ def sanitize_backtrace(output) .gsub(%r{^\s+# [^\s]+/(?:bin|bundler|rubygems|gems)/.+$\n}, "") # get rid of backtraces outside of rspec-abq .gsub(%r{^\s*"[^\s]+/(?:bin|bundler|rubygems|gems)/.+",?$}, "") # get rid of backtraces outside of rspec-abq in pretty JSON .gsub(%r{\\n\s+(?:\\u001b\[36m)?# [^\s]+/(?:bin|bundler|rubygems|gems)/.+\\n}, "") # get rid of backtraces outside of rspec-abq in escaped strings + .gsub(%r{^\s*":187:in\s+`loop'",\n}, "") # this is showing up on select version combinations of ruby and rspec .gsub(/\.rb:\d+/, ".rb:0") # get rid of line numbers to avoid unecessary test churn end diff --git a/spec/rspec/abq_spec.rb b/spec/rspec/abq_spec.rb index b82139d8..3d61d6f1 100644 --- a/spec/rspec/abq_spec.rb +++ b/spec/rspec/abq_spec.rb @@ -180,6 +180,14 @@ def stringify_keys(hash) end it "fails with ConnectionFailed when connection times out", aggregate_failures: true do + ruby_3_2_or_greater = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2.0") + if ruby_3_2_or_greater && RSpec::Core::Version::STRING == "3.10.2" + pending "This is failing on RSpec 3.10 but passing on 3.8, 3.9, and 3.11+. Assuming bug in that verison of RSpec." + # The failure is. + # # received :tcp with unexpected arguments + # expected: ("127.0.0.1", "43809", {:connect_timeout=>1}) + # got: ("127.0.0.1", "43809", {:connect_timeout=>1}) + end # Force this error to avoid flakiness. expect(Socket).to receive(:tcp).with(host, port.to_s, connect_timeout: 0.001) .and_raise(Errno::ETIMEDOUT, "forced error")