rspec_trunk_flaky_tests 0.14.0.pre.beta.2 → 0.14.0.pre.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trunk_spec_helper.rb +22 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 408ca964aad8a355970e382136d223184afff694543cefaa546170a405a0d5cf
4
- data.tar.gz: d52653eb7de5b9d3f58983bdb14d76fdb364b7f9976abf6ac8876652cacbc30c
3
+ metadata.gz: 69ead5f580e531391a6a6746a7160e5d719cb92ffb911fc5b818d75120501f3f
4
+ data.tar.gz: a4bc7a5438e9d233ef8048a7c84871f0709af2ec13b2f6b975313fbd8531176d
5
5
  SHA512:
6
- metadata.gz: 862f020fd6c96d7fe08f572a001ae7d8d4db383e0048a45a04aea7afc0b7261e1efafcf1f1c677e9271bf60195513a2f8317f8c478be8178757ce00659eebe49
7
- data.tar.gz: 0f87e16e146da81248d386b9d60aadd6c0b3f1f8646eb0d6751947cbbac9ca2e8e00be842fa04bccc7ce2d9a9ee391d2f8f8a17bb7148c04e96f203bfacaebce
6
+ metadata.gz: 7ff22ceedb68d2e03c816681013359a5a6b917e28a72e51de8aebe2131fead066c8859da274715a8f0062123c1a361747ff3ebe45600542d72c375d4a8c79b47
7
+ data.tar.gz: 0adb3eba10a07cbe34392d2aefe253bde069dcfaa0ac621e60c294225bd7b7bac34115845520be2bfb8d502224b36bf0cd545fc3845c7fd231daafbcda7f736e
@@ -108,11 +108,25 @@ module RSpec
108
108
  # decide if we want to fail the test or not
109
109
  # trunk-ignore(rubocop/Naming/AccessorMethodName)
110
110
  def set_exception(exception)
111
- return set_exception_core(exception) if metadata[:pending]
111
+ # Pending stays green, except a fixed pending example is a real failure.
112
+ return set_exception_core(exception) if metadata[:pending] && !pending_example_fixed?(exception)
112
113
  return set_exception_core(exception) if trunk_disabled
113
114
  return set_exception_core(exception) if metadata[:retry_attempts]&.positive?
114
115
 
116
+ handle_quarantine_check_safely(exception)
117
+ end
118
+
119
+ # If the quarantine machinery itself blows up, the failure must stand.
120
+ def handle_quarantine_check_safely(exception)
115
121
  handle_quarantine_check(exception)
122
+ rescue StandardError => e
123
+ puts "Quarantine check errored (#{e.class}: #{e.message}), treating test as not quarantined".yellow
124
+ set_exception_core(exception)
125
+ end
126
+
127
+ def pending_example_fixed?(exception)
128
+ defined?(RSpec::Core::Pending::PendingExampleFixedError) &&
129
+ exception.is_a?(RSpec::Core::Pending::PendingExampleFixedError)
116
130
  end
117
131
 
118
132
  # trunk-ignore(rubocop/Metrics/AbcSize,rubocop/Metrics/MethodLength,rubocop/Metrics/CyclomaticComplexity)
@@ -401,10 +415,13 @@ class TrunkAnalyticsListener
401
415
  # the build (the pending expectation was violated), so it is a failure here too.
402
416
  [Status.new('failure'), example.exception || quarantined_exception]
403
417
  when :pending
404
- # Not a skip (handled above), so this is a pending example whose body ran and
405
- # failed as expected: the pending expectation ("this should fail") was met, so
406
- # RSpec keeps the build green -- report it as a success.
407
- [Status.new('success'), nil]
418
+ # A quarantined fixed-pending is left :pending but pending_fixed? -- still a
419
+ # failure. Otherwise the pending "should fail" expectation was met -> success.
420
+ if result.pending_fixed?
421
+ [Status.new('failure'), quarantined_exception || example.exception]
422
+ else
423
+ [Status.new('success'), nil]
424
+ end
408
425
  else
409
426
  [Status.new(result.status.to_s), example.exception || quarantined_exception]
410
427
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_trunk_flaky_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0.pre.beta.2
4
+ version: 0.14.0.pre.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trunk Technologies, Inc.