Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ruby/lib/rspec/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def finish(reporter, acknowledge: true)
dup.mark_as_requeued!(reporter)
return true
else
reporter.acknowledge if skipped?
super(reporter)
end
else
Expand Down Expand Up @@ -422,7 +423,7 @@ def cancel_run!
end

def acknowledge
@queue.acknowledge(@example)
@queue.acknowledge(@example.id)
end
end

Expand Down
10 changes: 10 additions & 0 deletions ruby/test/fixtures/pending/spec/dummy_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true
RSpec.describe Object do
it "works" do
expect(1 + 1).to be == 2
end

xit "pending 'xit' example should be ignored" do
expect(true).to eq false
end
end
4 changes: 4 additions & 0 deletions ruby/test/fixtures/pending/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true
RSpec.configure do |config|
config.backtrace_inclusion_patterns << %r{/test/fixtures/}
end
49 changes: 49 additions & 0 deletions ruby/test/integration/rspec_redis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,55 @@ def test_redis_runner_retry
assert_equal 0, $?.exitstatus
end

def test_redis_runner_pending
@order_path = File.expand_path('../../fixtures/pending/log/test_order.log', __FILE__)
out, err = capture_subprocess_io do
system(
{ 'BUILDKITE' => '1', 'BUILDKITE_COMMIT' => 'aaaaaaaaaaaaa' },
@exe,
'--queue', @redis_url,
'--seed', '123',
'--build', '1',
'--worker', '1',
'--timeout', '1',
chdir: 'test/fixtures/pending',
)
assert_equal 0, $?.exitstatus
end

assert_empty err
expected_output = strip_heredoc <<-EOS
Worker elected as leader, pushing 2 tests to the queue.

Finished pushing 2 tests to the queue in X.XXs.

Randomized with seed 123
.*

Pending: (Failures listed here are expected and do not affect your suite's status)

1) Object pending 'xit' example should be ignored
# Temporarily skipped with xit
# ./spec/dummy_spec.rb:7

Finished in X.XXXXX seconds (files took X.XXXXX seconds to load)
2 examples, 0 failures, 1 pending

Randomized with seed 123

EOS

assert_equal expected_output, normalize(out)


expected_test_order = [
"./spec/dummy_spec.rb[1:1]\n",
"./spec/dummy_spec.rb[1:2]\n",
]

assert_equal expected_test_order, File.read(@order_path).lines
end

def test_retry_report
# Run first worker, failing all tests
out, err = capture_subprocess_io do
Expand Down
Loading