rspec_trunk_flaky_tests 0.13.0 → 0.13.1.pre.beta.1

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 +16 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 720032e93ac64186adc9b0b574e5c656bbdd7276ffc3d91c4d2535e6292c72f7
4
- data.tar.gz: 82e216a32a19291f335a2f7ef750d6a95bf6cd23b8d2c4154947d75daf06af2b
3
+ metadata.gz: 4aa6a7c76e25e9839d41e75b20807ddcdbc72dc0099dedd2233585adeed5b003
4
+ data.tar.gz: 8411b85765ea6cd73e4d76e343be9b2ec5238fbd700b6ab464b43c256013ddbe
5
5
  SHA512:
6
- metadata.gz: 6a48283f2d325848adc5e7020541170ab53ae7666252cd2cf069adb503adfc34a36c0fe5fbe82e1ebde39acaf45a631131087e1b44a82f195a74f8b635ada58c
7
- data.tar.gz: 0b17ee5631b648a82fe0905e6918e24e1abe880c43fe7d7fb265a4e659b30724e1359ada1eb60a026578a1908c249947325d9b9a5cc36a95cf28542785d4d46f
6
+ metadata.gz: 1b5fd8181c5f59c1efdd3a46b1cb7a6f193fd70c2276a1de4c3786b5f1a963ba62336d7d7707e8617ac032e7d085942e187bb9aeae76d82f848b47f0f14fa189
7
+ data.tar.gz: 9823a40ac411de794f3a29f59b756e68ffb6f17818b000d8988e6464e6b470047a74485fc4cc2af040c0ecb6bbaf061e4fd24759a6cae690d82046ce652735aa
@@ -27,6 +27,8 @@
27
27
  # TRUNK_USE_UNCLONED_REPO - Set to 'true' for uncloned repo mode
28
28
  # TRUNK_LOCAL_UPLOAD_DIR - Directory to save test results locally (disables upload)
29
29
  # TRUNK_QUARANTINED_TESTS_DISK_CACHE_TTL_SECS - Time to cache quarantined tests on disk (in seconds)
30
+ # TRUNK_QUARANTINE_QUERY_FAILURE_EXIT - Set to 'true' to abort the RSpec run when quarantine
31
+ # lookup fails (remaining examples are skipped)
30
32
  # DISABLE_RSPEC_TRUNK_FLAKY_TESTS - Set to 'true' to completely disable Trunk
31
33
  #
32
34
  require 'rspec/core'
@@ -84,6 +86,10 @@ def trunk_disabled
84
86
  ENV['TRUNK_ORG_URL_SLUG'].nil? || ENV['TRUNK_API_TOKEN'].nil?
85
87
  end
86
88
 
89
+ def quarantine_query_failure_exit?
90
+ ENV['TRUNK_QUARANTINE_QUERY_FAILURE_EXIT'] == 'true'
91
+ end
92
+
87
93
  # we want to cache the test report in memory so we can add to it as we go and reduce the number of API calls
88
94
  $test_report = TestReport.new('rspec', "#{$PROGRAM_NAME} #{ARGV.join(' ')}", nil)
89
95
  $failure_encountered_and_quarantining_disabled = false
@@ -126,6 +132,10 @@ module RSpec
126
132
  puts 'Failed to check quarantining status, no failures will be quarantined'.yellow
127
133
  $failure_encountered_and_quarantine_lookup_failed = true
128
134
  end
135
+ if quarantine_query_failure_exit?
136
+ puts 'Quarantine lookup failed, exiting early'.red
137
+ RSpec.world.wants_to_quit = true
138
+ end
129
139
  set_exception_core(exception)
130
140
  elsif is_quarantined_result.quarantining_disabled_for_repo
131
141
  unless $failure_encountered_and_quarantining_disabled
@@ -365,6 +375,12 @@ end
365
375
  RSpec.configure do |c|
366
376
  next if trunk_disabled
367
377
 
378
+ c.before(:example) do
379
+ if $failure_encountered_and_quarantine_lookup_failed && quarantine_query_failure_exit?
380
+ skip('Quarantine lookup failed, skipping test run')
381
+ end
382
+ end
383
+
368
384
  c.reporter.register_listener TrunkAnalyticsListener.new, :example_finished, :close
369
385
  end
370
386
 
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.13.0
4
+ version: 0.13.1.pre.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trunk Technologies, Inc.