Skip to content

Migrate from RSpec to Minitest#824

Closed
mensfeld wants to merge 41 commits intomasterfrom
move-from-rspec-minitest
Closed

Migrate from RSpec to Minitest#824
mensfeld wants to merge 41 commits intomasterfrom
move-from-rspec-minitest

Conversation

@mensfeld
Copy link
Member

@mensfeld mensfeld commented Mar 7, 2026

No description provided.

@mensfeld mensfeld requested a review from Copilot March 7, 2026 18:59
@mensfeld mensfeld self-assigned this Mar 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the Ruby test suite from RSpec to Minitest and updates project tooling (CI, linting, coverage) to match the new test runner.

Changes:

  • Replaces RSpec specs with Minitest test files under test/ and updates helpers accordingly.
  • Updates CI workflows to run rake test and switches RuboCop/Standard plugins from RSpec to Minitest.
  • Adjusts packaging/lint/coverage configuration to exclude the new test suite paths.

Reviewed changes

Copilot reviewed 79 out of 85 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/lib/rdkafka/producer/partitions_count_cache_test.rb Adds Minitest coverage for PartitionsCountCache behaviors formerly in RSpec.
test/lib/rdkafka/producer/delivery_report_test.rb Ports DeliveryReport specs to Minitest assertions.
test/lib/rdkafka/producer/delivery_handle_test.rb Ports DeliveryHandle wait/result behaviors from RSpec to Minitest.
test/lib/rdkafka/native_kafka_test.rb Replaces RSpec doubles/stubs with Minitest::Mock and stub.
test/lib/rdkafka/metadata_test.rb Migrates metadata-related specs to Minitest.
test/lib/rdkafka/error_test.rb Migrates error object specs to Minitest.
test/lib/rdkafka/defaults_test.rb Migrates defaults constant specs to Minitest.
test/lib/rdkafka/consumer/topic_partition_list_test.rb Migrates TopicPartitionList specs to Minitest.
test/lib/rdkafka/consumer/partition_test.rb Migrates Partition specs to Minitest.
test/lib/rdkafka/consumer/message_test.rb Migrates Message specs to Minitest; keeps FFI stubbing.
test/lib/rdkafka/consumer/headers_test.rb Re-implements headers parsing specs using pure Minitest + FFI pointers.
test/lib/rdkafka/config_test.rb Migrates config-related specs to Minitest.
test/lib/rdkafka/bindings_test.rb Migrates bindings/callback specs to Minitest.
test/lib/rdkafka/admin/list_offsets_report_test.rb Adds Minitest coverage for list offsets report null handling.
test/lib/rdkafka/admin/list_offsets_handle_test.rb Adds Minitest coverage for list offsets handle behaviors.
test/lib/rdkafka/admin/describe_acl_report_test.rb Adds Minitest coverage for describe ACL report parsing.
test/lib/rdkafka/admin/describe_acl_handle_test.rb Adds Minitest coverage for describe ACL handle behaviors.
test/lib/rdkafka/admin/delete_topic_report_test.rb Adds Minitest coverage for delete topic report fields.
test/lib/rdkafka/admin/delete_topic_handle_test.rb Adds Minitest coverage for delete topic handle behaviors.
test/lib/rdkafka/admin/delete_acl_report_test.rb Adds Minitest coverage for delete ACL report parsing.
test/lib/rdkafka/admin/delete_acl_handle_test.rb Adds Minitest coverage for delete ACL handle behaviors.
test/lib/rdkafka/admin/create_topic_report_test.rb Adds Minitest coverage for create topic report fields.
test/lib/rdkafka/admin/create_topic_handle_test.rb Adds Minitest coverage for create topic handle behaviors.
test/lib/rdkafka/admin/create_acl_report_test.rb Adds Minitest coverage for create ACL report fields.
test/lib/rdkafka/admin/create_acl_handle_test.rb Adds Minitest coverage for create ACL handle behaviors.
test/lib/rdkafka/abstract_handle_test.rb Migrates abstract handle registry/wait behavior specs to Minitest.
spec/spec_helper.rb Reworks the helper to Minitest initialization, suite setup, and per-test timeouts.
spec/lib/rdkafka/producer/partitions_count_cache_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/producer/delivery_report_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/producer/delivery_handle_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/native_kafka_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/metadata_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/error_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/defaults_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/consumer/topic_partition_list_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/consumer/partition_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/consumer/message_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/consumer/headers_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/config_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/callbacks_spec.rb Updates a leftover spec file to require test_helper (transition artifact).
spec/lib/rdkafka/bindings_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin_spec.rb Removes the large RSpec admin suite (not yet replaced here).
spec/lib/rdkafka/admin/list_offsets_report_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/list_offsets_handle_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/describe_acl_report_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/describe_acl_handle_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/delete_topic_report_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/delete_topic_handle_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/delete_acl_report_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/delete_acl_handle_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/create_topic_report_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/create_topic_handle_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/create_acl_report_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/admin/create_acl_handle_spec.rb Removes RSpec test file in favor of Minitest replacement.
spec/lib/rdkafka/abstract_handle_spec.rb Removes RSpec test file in favor of Minitest replacement.
rdkafka.gemspec Updates gem packaging filters to exclude test/ instead of spec/.
Rakefile Adds a Minitest rake task and makes it the default.
Gemfile.lint.lock Switches lint tooling dependencies from RSpec cops to Minitest cops.
Gemfile.lint Replaces rubocop-rspec / standard-rspec with Minitest equivalents.
Gemfile Adds Minitest dependencies and removes RSpec.
CHANGELOG.md Documents the test framework migration under an unreleased version.
.yard-lint.yml Updates yard-lint exclusions from spec/ to test/.
.rubocop.yml Updates RuboCop plugins/standard config from RSpec to Minitest.
.rspec Removes RSpec runner configuration file.
.github/workflows/ci_macos_arm64.yml Runs rake test instead of rspec.
.github/workflows/ci_linux_ubuntu_x86_64_gnu_complementary.yml Runs rake test and points integration paths at test/integrations.
.github/workflows/ci_linux_ubuntu_x86_64_gnu.yml Runs rake test instead of rspec (including SSL job).
.github/workflows/ci_linux_ubuntu_aarch64_gnu_complementary.yml Runs rake test and points integration paths at test/integrations.
.github/workflows/ci_linux_ubuntu_aarch64_gnu.yml Runs rake test instead of rspec.
.github/workflows/ci_linux_debian_x86_64_gnu_complementary.yml Runs rake test and points integration paths at test/integrations.
.github/workflows/ci_linux_debian_x86_64_gnu.yml Runs rake test instead of rspec.
.github/workflows/ci_linux_alpine_x86_64_musl_complementary.yml Runs rake test and points integration paths at test/integrations.
.github/workflows/ci_linux_alpine_x86_64_musl.yml Runs rake test instead of rspec.
.github/workflows/ci_linux_alpine_aarch64_musl_complementary.yml Runs rake test and points integration paths at test/integrations.
.github/workflows/ci_linux_alpine_aarch64_musl.yml Runs rake test instead of rspec.
Comments suppressed due to low confidence (3)

test/lib/rdkafka/consumer/headers_test.rb:1

  • FFI::MemoryPointer#write_pointer expects an FFI::Pointer, but this stub writes an Integer (headers_ptr.object_id). This will raise TypeError (or produce invalid pointers) when the production code later reads the pointer. Use a real FFI::Pointer value for headers_ptr (for example, allocate a small FFI::MemoryPointer and write that pointer), and write that pointer into ptr.
    test/lib/rdkafka/native_kafka_test.rb:1
  • Minitest::Mock expectations are only enforced when verify is called, but @thread.verify is never invoked. As a result, tests can pass even if name=, []= or abort_on_exception= are not called. Consider verifying the mock in teardown (ideally in an ensure so it runs even if the test fails) and also verifying any mock threads created inside individual tests (for example in test_polling_thread_is_created).
    test/lib/rdkafka/native_kafka_test.rb:1
  • Minitest::Mock expectations are only enforced when verify is called, but @thread.verify is never invoked. As a result, tests can pass even if name=, []= or abort_on_exception= are not called. Consider verifying the mock in teardown (ideally in an ensure so it runs even if the test fails) and also verifying any mock threads created inside individual tests (for example in test_polling_thread_is_created).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

files = files.reject do |file|
next true if file.start_with?(".")
next true if file.start_with?("spec/")
next true if file.start_with?("test/")
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the packaged-files exclusion from spec/ to test/, but spec/ still exists in this PR (for example spec/spec_helper.rb). That means the gem may now inadvertently ship spec/ artifacts. If the intent is to exclude all test infrastructure from the gem, also exclude spec/ (or remove/move the remaining spec/ files).

Suggested change
next true if file.start_with?("test/")
next true if file.start_with?("test/")
next true if file.start_with?("spec/")

Copilot uses AI. Check for mistakes.
- vendor/**/*
- node_modules/**/*
- spec/**/*
- test/**/*
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This switches YARD lint exclusions from spec/** to test/**, but the PR still retains files under spec/ (notably spec/spec_helper.rb). If yard-lint runs over spec/ now, it may unexpectedly fail coverage/validation. Either remove/move remaining spec/ files, or keep excluding spec/** as well.

Suggested change
- test/**/*
- test/**/*
- spec/**/*

Copilot uses AI. Check for mistakes.
@mensfeld mensfeld closed this Mar 24, 2026
@mensfeld mensfeld deleted the move-from-rspec-minitest branch March 24, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants