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

Skip intermittently failing tests #1987

Merged
merged 1 commit into from
May 1, 2023
Merged
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
12 changes: 12 additions & 0 deletions test/new_relic/agent/pipe_channel_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def test_listener_merges_transaction_traces
end

def test_listener_merges_error_traces
skip_for_ruby_2_5_9_and_rails_6_x

sampler = NewRelic::Agent.agent.error_collector
sampler.notice_error(Exception.new('message'), :uri => '/myurl/',
:metric => 'path', :referer => 'test_referer',
Expand Down Expand Up @@ -130,6 +132,8 @@ def test_listener_merges_analytics_events
end

def test_listener_merges_error_events
skip_for_ruby_2_5_9_and_rails_6_x

error_event_aggregator = NewRelic::Agent.agent.error_collector.error_event_aggregator
reset_lifetime_counts!(error_event_aggregator)

Expand Down Expand Up @@ -360,4 +364,12 @@ def reset_lifetime_counts!(container)
buffer.instance_variable_set(:@captured_lifetime, 0)
buffer.instance_variable_set(:@seen_lifetime, 0)
end

def skip_for_ruby_2_5_9_and_rails_6_x
# TODO: MAJOR VERSION - remove this method and its calls when Ruby 2.5 is no longer supported
skip if RUBY_VERSION == '2.5.9' &&
defined?(Rails::VERSION::STRING) &&
# version string starts with 6.0 or 6.1
Rails::VERSION::STRING =~ /\A6\.(0|1)/
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that there won't be a Rails 6.2, I think checking for Rails::VERSION::MAJOR and then doing Rails::VERSION::MAJOR == 6 would suffice. Given the context (test code only) there's no need to change it though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this suggestion. I thought about that too, even though it seems unlikely/unprecedented 6.2 would ever come out, I figured it might be better to specify.

end
end