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.
- checksums.yaml +4 -4
- data/lib/trunk_spec_helper.rb +22 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 69ead5f580e531391a6a6746a7160e5d719cb92ffb911fc5b818d75120501f3f
|
|
4
|
+
data.tar.gz: a4bc7a5438e9d233ef8048a7c84871f0709af2ec13b2f6b975313fbd8531176d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ff22ceedb68d2e03c816681013359a5a6b917e28a72e51de8aebe2131fead066c8859da274715a8f0062123c1a361747ff3ebe45600542d72c375d4a8c79b47
|
|
7
|
+
data.tar.gz: 0adb3eba10a07cbe34392d2aefe253bde069dcfaa0ac621e60c294225bd7b7bac34115845520be2bfb8d502224b36bf0cd545fc3845c7fd231daafbcda7f736e
|
data/lib/trunk_spec_helper.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
#
|
|
405
|
-
#
|
|
406
|
-
|
|
407
|
-
|
|
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
|