Class: Mergify::RSpec::CIInsights
- Inherits:
-
Object
- Object
- Mergify::RSpec::CIInsights
- Defined in:
- lib/mergify/rspec/ci_insights.rb
Overview
Central orchestrator for Mergify Test Insights: sets up OpenTelemetry tracing, manages the tracer provider, and coordinates flaky detection and quarantine. rubocop:disable Metrics/ClassLength
Instance Attribute Summary collapse
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#branch_name ⇒ Object
readonly
Returns the value of attribute branch_name.
-
#exporter ⇒ Object
readonly
Returns the value of attribute exporter.
-
#flaky_detector ⇒ Object
readonly
Returns the value of attribute flaky_detector.
-
#flaky_detector_error_message ⇒ Object
readonly
Returns the value of attribute flaky_detector_error_message.
-
#quarantined_tests ⇒ Object
readonly
Returns the value of attribute quarantined_tests.
-
#repo_name ⇒ Object
readonly
Returns the value of attribute repo_name.
-
#test_run_id ⇒ Object
readonly
Returns the value of attribute test_run_id.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#tracer ⇒ Object
readonly
Returns the value of attribute tracer.
-
#tracer_provider ⇒ Object
readonly
Returns the value of attribute tracer_provider.
Instance Method Summary collapse
-
#initialize ⇒ CIInsights
constructor
rubocop:disable Metrics/MethodLength.
-
#mark_test_as_quarantined_if_needed(example_id) ⇒ Object
rubocop:enable Metrics/MethodLength.
Constructor Details
#initialize ⇒ CIInsights
rubocop:disable Metrics/MethodLength
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mergify/rspec/ci_insights.rb', line 27 def initialize @token = ENV.fetch('MERGIFY_TOKEN', nil) @repo_name = Utils.repository_name @api_url = ENV.fetch('MERGIFY_API_URL', 'https://api.mergify.com') @test_run_id = SecureRandom.hex(8) @tracer_provider = nil @tracer = nil @exporter = nil @branch_name = nil @flaky_detector = nil @flaky_detector_error_message = nil @quarantined_tests = nil setup_tracing if Utils.in_ci? end |
Instance Attribute Details
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def api_url @api_url end |
#branch_name ⇒ Object (readonly)
Returns the value of attribute branch_name.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def branch_name @branch_name end |
#exporter ⇒ Object (readonly)
Returns the value of attribute exporter.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def exporter @exporter end |
#flaky_detector ⇒ Object (readonly)
Returns the value of attribute flaky_detector.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def flaky_detector @flaky_detector end |
#flaky_detector_error_message ⇒ Object (readonly)
Returns the value of attribute flaky_detector_error_message.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def @flaky_detector_error_message end |
#quarantined_tests ⇒ Object (readonly)
Returns the value of attribute quarantined_tests.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def quarantined_tests @quarantined_tests end |
#repo_name ⇒ Object (readonly)
Returns the value of attribute repo_name.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def repo_name @repo_name end |
#test_run_id ⇒ Object (readonly)
Returns the value of attribute test_run_id.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def test_run_id @test_run_id end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def token @token end |
#tracer ⇒ Object (readonly)
Returns the value of attribute tracer.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def tracer @tracer end |
#tracer_provider ⇒ Object (readonly)
Returns the value of attribute tracer_provider.
21 22 23 |
# File 'lib/mergify/rspec/ci_insights.rb', line 21 def tracer_provider @tracer_provider end |
Instance Method Details
#mark_test_as_quarantined_if_needed(example_id) ⇒ Object
rubocop:enable Metrics/MethodLength
44 45 46 47 48 49 |
# File 'lib/mergify/rspec/ci_insights.rb', line 44 def mark_test_as_quarantined_if_needed(example_id) # rubocop:disable Naming/PredicateMethod return false unless @quarantined_tests&.include?(example_id) @quarantined_tests.mark_as_used(example_id) true end |