Skip to content

Commit

Permalink
Fix report flaky section
Browse files Browse the repository at this point in the history
Signed-off-by: Crola1702 <[email protected]>
  • Loading branch information
Crola1702 committed Sep 18, 2024
1 parent 0db167d commit b005ebf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 4 additions & 3 deletions database/scripts/generate_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
options[:report_name] = "buildfarm-report_#{DateTime.now.strftime("%Y-%m-%d_%H-%M")}.json" if options[:report_name].nil?

def generate_report(report_name, exclude_set)
report_regressions_all = BuildfarmToolsLib::test_regressions_all(filter_known: true)
report_regressions_all = BuildfarmToolsLib::test_regressions_all(filter_known: true).freeze # Freeze as this is a read-only variable
report_regressions_consecutive = BuildfarmToolsLib::test_regressions_today(filter_known: true, only_consistent: true, group_issues: true, report_regressions: report_regressions_all)
report_flaky_regressions = BuildfarmToolsLib::flaky_test_regressions(filter_known: true, group_issues: true, report_regressions: report_regressions_all)

report = {
'urgent' => {
'build_regressions' => BuildfarmToolsLib::build_regressions_today(filter_known: true),
'test_regressions_consecutive' => report_regressions_consecutive ,
'test_regressions_flaky' => BuildfarmToolsLib::flaky_test_regressions(filter_known: true, group_issues: true),
'test_regressions_consecutive' => report_regressions_consecutive,
'test_regressions_flaky' => report_flaky_regressions,
},
'maintenance' => {
'jobs_last_success_date' => BuildfarmToolsLib::jobs_last_success_date(older_than_days: 7),
Expand Down
9 changes: 7 additions & 2 deletions database/scripts/lib/buildfarm_tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def self.error_appearances_in_job(test_name, job_name)
run_command('./sql_run.sh error_appearances_in_job.sql', args: [test_name, job_name])
end

def self.test_regressions_all(filter_known: false)
def self.test_regressions_all(filter_known: false, include_reports: true)
# Keys: job_name, build_number, error_name, build_datetime, node_name
out = run_command('./sql_run.sh errors_check_last_build.sql')
if filter_known
Expand All @@ -41,12 +41,17 @@ def self.test_regressions_all(filter_known: false)
known_error_names = Set.new(known_errors.map { |e| e['error_name'] })
out.filter! { |e| !known_error_names.include? e['error_name'] }
end
if include_reports
out.each do |e|
e['reports'] = test_regression_reported_issues e['error_name']
end
end
out
end

def self.test_regressions_today(filter_known: false, only_consistent: false, group_issues: false, report_regressions: [])
# Keys: job_name, build_number, error_name, build_datetime, node_name
out = report_regressions
out = report_regressions.clone(freeze: false) # Clone because we return the same array but modified
out = test_regressions_all(filter_known: filter_known) if out.empty?
if only_consistent
out.filter! { |tr| tr['age'].to_i >= CONSECUTIVE_THRESHOLD || tr['age'].to_i == WARNING_AGE_CONSTANT }
Expand Down

0 comments on commit b005ebf

Please sign in to comment.