From 36e363d33d5f75aeb75c552d4b325ed8c2d6105f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 21 Jan 2020 21:08:54 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- scripts/detect-new-flaky-examples | 21 ------------------ scripts/flaky_examples/detect-new-flaky-examples | 21 ++++++++++++++++++ scripts/flaky_examples/prune-old-flaky-examples | 28 ++++++++++++++++++++++++ scripts/prune-old-flaky-specs | 28 ------------------------ scripts/rspec_helpers.sh | 2 +- 5 files changed, 50 insertions(+), 50 deletions(-) delete mode 100755 scripts/detect-new-flaky-examples create mode 100755 scripts/flaky_examples/detect-new-flaky-examples create mode 100755 scripts/flaky_examples/prune-old-flaky-examples delete mode 100755 scripts/prune-old-flaky-specs (limited to 'scripts') diff --git a/scripts/detect-new-flaky-examples b/scripts/detect-new-flaky-examples deleted file mode 100755 index 3bee4f9a34b..00000000000 --- a/scripts/detect-new-flaky-examples +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env ruby - -require 'json' - -report_file = ARGV.shift -unless report_file - puts 'usage: detect-new-flaky-examples ' - exit 1 -end - -puts "Loading #{report_file}..." -report = JSON.parse(File.read(report_file)) - -if report.any? - puts "New flaky examples were detected!\n" - puts JSON.pretty_generate(report) - exit 1 -else - puts "No new flaky examples detected.\n" - exit 0 -end diff --git a/scripts/flaky_examples/detect-new-flaky-examples b/scripts/flaky_examples/detect-new-flaky-examples new file mode 100755 index 00000000000..3bee4f9a34b --- /dev/null +++ b/scripts/flaky_examples/detect-new-flaky-examples @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby + +require 'json' + +report_file = ARGV.shift +unless report_file + puts 'usage: detect-new-flaky-examples ' + exit 1 +end + +puts "Loading #{report_file}..." +report = JSON.parse(File.read(report_file)) + +if report.any? + puts "New flaky examples were detected!\n" + puts JSON.pretty_generate(report) + exit 1 +else + puts "No new flaky examples detected.\n" + exit 0 +end diff --git a/scripts/flaky_examples/prune-old-flaky-examples b/scripts/flaky_examples/prune-old-flaky-examples new file mode 100755 index 00000000000..7700b93438b --- /dev/null +++ b/scripts/flaky_examples/prune-old-flaky-examples @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby + +# lib/rspec_flaky/flaky_examples_collection.rb is requiring +# `active_support/hash_with_indifferent_access`, and we install the `activesupport` +# gem manually on the CI +require 'rubygems' + +# In newer Ruby, alias_method is not private then we don't need __send__ +singleton_class.__send__(:alias_method, :require_dependency, :require) # rubocop:disable GitlabSecurity/PublicSend +$:.unshift(File.expand_path('../lib', __dir__)) + +require 'rspec_flaky/report' + +report_file = ARGV.shift +unless report_file + puts 'usage: prune-old-flaky-specs ' + 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 + +puts "New report has #{new_report.size} entries: #{report.size - new_report.size} entries older than #{RspecFlaky::Report::OUTDATED_DAYS_THRESHOLD} days were removed." +puts "Saved #{new_report_file}." if new_report.write(new_report_file) diff --git a/scripts/prune-old-flaky-specs b/scripts/prune-old-flaky-specs deleted file mode 100755 index a00a334fd6e..00000000000 --- a/scripts/prune-old-flaky-specs +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env ruby - -# lib/rspec_flaky/flaky_examples_collection.rb is requiring -# `active_support/hash_with_indifferent_access`, and we install the `activesupport` -# gem manually on the CI -require 'rubygems' - -# In newer Ruby, alias_method is not private then we don't need __send__ -singleton_class.__send__(:alias_method, :require_dependency, :require) # rubocop:disable GitlabSecurity/PublicSend -$:.unshift(File.expand_path('../lib', __dir__)) - -require 'rspec_flaky/report' - -report_file = ARGV.shift -unless report_file - puts 'usage: prune-old-flaky-specs ' - 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 - -puts "New report has #{new_report.size} entries: #{report.size - new_report.size} entries older than 90 days were removed." -puts "Saved #{new_report_file}." if new_report.write(new_report_file) diff --git a/scripts/rspec_helpers.sh b/scripts/rspec_helpers.sh index 23e76980926..8762108066d 100644 --- a/scripts/rspec_helpers.sh +++ b/scripts/rspec_helpers.sh @@ -25,7 +25,7 @@ function update_tests_metadata() { scripts/merge-reports "${FLAKY_RSPEC_SUITE_REPORT_PATH}" rspec_flaky/all_*.json export FLAKY_RSPEC_GENERATE_REPORT="1" - scripts/prune-old-flaky-specs "${FLAKY_RSPEC_SUITE_REPORT_PATH}" + scripts/flaky_examples/prune-old-flaky-examples "${FLAKY_RSPEC_SUITE_REPORT_PATH}" if [[ -n ${TESTS_METADATA_S3_BUCKET} ]]; then scripts/sync-reports put "${TESTS_METADATA_S3_BUCKET}" "${FLAKY_RSPEC_SUITE_REPORT_PATH}" -- cgit v1.2.3