debian-mirror-gitlab/scripts/flaky_examples/prune-old-flaky-examples

25 lines
872 B
Text
Raw Normal View History

2018-10-15 14:42:47 +05:30
#!/usr/bin/env ruby
2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
2021-04-17 20:07:23 +05:30
# tooling/rspec_flaky/flaky_examples_collection.rb is requiring
2018-10-15 14:42:47 +05:30
# `active_support/hash_with_indifferent_access`, and we install the `activesupport`
# gem manually on the CI
require 'rubygems'
2021-04-17 20:07:23 +05:30
require_relative '../../tooling/rspec_flaky/report'
2018-10-15 14:42:47 +05:30
report_file = ARGV.shift
unless report_file
puts 'usage: prune-old-flaky-specs <report-file> <new-report-file>'
exit 1
end
new_report_file = ARGV.shift || report_file
report = RspecFlaky::Report.load(report_file)
puts "Loading #{report_file}..."
puts "Current report has #{report.size} entries."
new_report = report.prune_outdated
2020-03-13 15:44:24 +05:30
puts "New report has #{new_report.size} entries: #{report.size - new_report.size} entries older than #{RspecFlaky::Report::OUTDATED_DAYS_THRESHOLD} days were removed."
2018-10-15 14:42:47 +05:30
puts "Saved #{new_report_file}." if new_report.write(new_report_file)