Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parallel integration specs to CI #1424

Merged
merged 1 commit into from
Mar 5, 2024
Merged
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ jobs:
bundle exec rspec \
spec/integration/mutant/null_spec.rb \
spec/integration/mutant/isolation/fork_spec.rb \
spec/integration/mutant/test_mutator_handles_types_spec.rb
spec/integration/mutant/test_mutator_handles_types_spec.rb \
spec/integration/mutant/parallel_spec.rb
ruby-integration-minitest:
name: Integration Minitest
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/parallel/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def self.read_response(**attributes)
def read_till_final
readers = [response_reader, log_reader]

until result || error
until [email protected]? || error
status = deadline.status

break timeout unless status.ok?
Expand Down
18 changes: 9 additions & 9 deletions spec/integration/mutant/parallel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ def status
[
Mutant::Parallel::Response.new(
error: nil,
output: "Booting: 0\nPayload: 1\n",
log: "Booting: 0\nPayload: 1\n",
result: 2
),
Mutant::Parallel::Response.new(
error: nil,
output: "Payload: 2\n",
log: "Payload: 2\n",
result: 4
),
Mutant::Parallel::Response.new(
error: nil,
output: "Payload: 3\n",
log: "Payload: 3\n",
result: 6
)
]
Expand Down Expand Up @@ -98,10 +98,10 @@ def status

response_a, response_b = responses

expect(response_a).to eql(Mutant::Parallel::Response.new(output: '', result: nil, error: nil))
expect(response_a).to eql(Mutant::Parallel::Response.new(log: '', result: nil, error: nil))
expect(response_b.error).to be(EOFError)
expect(response_b.result).to be(nil)
expect(response_b.output.match?('<main>')).to be(true)
expect(response_b.log.match?('<main>')).to be(true)
end

specify 'massive' do
Expand Down Expand Up @@ -134,12 +134,12 @@ def status
[
Mutant::Parallel::Response.new(
error: nil,
output: "#{b}\n#{b}\n",
log: "#{b}\n#{b}\n",
result: b
),
Mutant::Parallel::Response.new(
error: nil,
output: "#{b}#{b}\n",
log: "#{b}#{b}\n",
result: b * 2
)
]
Expand Down Expand Up @@ -175,7 +175,7 @@ def status
expect(responses.length).to be(3)

responses.each do |response|
expect(response.output.match?(/<iteration \d+>/)).to be(true)
expect(response.log.match?(/<iteration \d+>/)).to be(true)
end
end

Expand Down Expand Up @@ -233,7 +233,7 @@ def status
expect(sink.status).to eql(
[
Mutant::Parallel::Response.new(
output: '',
log: '',
result: nil,
error: Timeout
)
Expand Down
33 changes: 33 additions & 0 deletions spec/unit/mutant/parallel/connection/reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,39 @@ def marshal_load
end

context 'on result' do
context 'with nil result' do
let(:result) { nil }

let(:raw_expectations) do
[
deadline_status,
select([response_reader]),
binmode(response_reader),
read(io: response_reader, bytes: 4, chunk: header_segment),
deadline_status,
select([response_reader]),
binmode(response_reader),
read(
bytes: result_segment.bytesize,
chunk: result_segment,
io: response_reader
),
marshal_load
]
end

it 'returns parallel result' do
verify_events do
expect(apply).to eql(
Mutant::Parallel::Response.new(
error: nil,
log: '',
result: result
)
)
end
end
end
context 'with full reads' do
let(:raw_expectations) do
[
Expand Down