Skip to content

Commit

Permalink
Merge pull request #55 from riemann/ruby-3.3
Browse files Browse the repository at this point in the history
Add Ruby 3.3 to the CI test matrix
  • Loading branch information
jamtur01 authored Jun 15, 2024
2 parents 3cb951c + a8cc529 commit 757b496
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
steps:
- uses: actions/checkout@v4
- name: Setup Ruby
Expand Down
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ Metrics/MethodLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
RSpec/IndexedLet:
Enabled: false
Style/Documentation:
Enabled: false
55 changes: 29 additions & 26 deletions spec/shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ def wait_for(&block)
raise 'wait_for condition never realized'
end

def roundtrip_metric(metric)
message_id = next_message_id

client_with_transport << {
service: 'metric-test',
metric: metric,
message_id: message_id
}

e = wait_for_message_with_id(message_id)
expect(e.metric).to eq(metric)
end

RSpec.shared_examples 'a riemann client' do
it 'is not connected before sending' do
expect(client).not_to be_connected
Expand Down Expand Up @@ -113,18 +100,34 @@ def roundtrip_metric(metric)
end
end

it 'send longs' do
roundtrip_metric(0)
roundtrip_metric(-3)
roundtrip_metric(5)
roundtrip_metric(-(2**63))
roundtrip_metric(2**63 - 1)
end
context 'when sending metrics' do
[
0,
-3,
5,
-(2**63),
2**63 - 1,
0.0,
12.0,
1.2300000190734863
].each do |metric|
context "with metric=#{metric}" do
before do
client_with_transport << {
service: 'metric-test',
metric: metric,
message_id: message_id
}
end

it 'send doubles' do
roundtrip_metric 0.0
roundtrip_metric 12.0
roundtrip_metric 1.2300000190734863
let(:message_id) { next_message_id }

it 'return the exact value that was sent' do
e = wait_for_message_with_id(message_id)
expect(e.metric).to eq(metric)
end
end
end
end

context 'when sending custom attributes' do
Expand Down Expand Up @@ -485,7 +488,7 @@ def roundtrip_metric(metric)
sleep INACTIVITY_TIME

client_with_transport << message2
wait_for_message_with_id(message_id2)
expect { wait_for_message_with_id(message_id2) }.not_to raise_exception
end
end

Expand Down Expand Up @@ -517,7 +520,7 @@ def roundtrip_metric(metric)
client.close

client_with_transport << message2
wait_for_message_with_id(message_id2)
expect { wait_for_message_with_id(message_id2) }.not_to raise_exception
end
end

Expand Down

0 comments on commit 757b496

Please sign in to comment.