From ec2d182743c295a5ac72b3fbe5ce43eaf58892cc Mon Sep 17 00:00:00 2001 From: Alisa Wallace <140003092+alisawallace@users.noreply.github.com> Date: Thu, 31 Aug 2023 09:25:36 -0700 Subject: [PATCH] FI-2041: Custom suites with no ids now throw standard error (#387) * Custom suites with no ids now throw standard error Original bug: a critical error would result when running custom test suites with either a) a blank id field (e.g., id = '') b) no id field and the console output did not provide meaningful information to the source of the error. These conditions are now checked for and will throw a standard error with a specific message upon startup * Resolving linter failures * Resolving linter failures * Add suite name to error output Co-authored-by: Stephen MacVicar * Combining suite ID checks into single condition --------- Co-authored-by: Stephen MacVicar --- Gemfile.lock | 1 + lib/inferno/config/boot/suites.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 4fdb00693..c761682d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -325,6 +325,7 @@ PLATFORMS arm64-darwin-21 arm64-darwin-22 x86_64-darwin-20 + x86_64-darwin-22 x86_64-linux DEPENDENCIES diff --git a/lib/inferno/config/boot/suites.rb b/lib/inferno/config/boot/suites.rb index b698b3e55..0e621b774 100644 --- a/lib/inferno/config/boot/suites.rb +++ b/lib/inferno/config/boot/suites.rb @@ -25,5 +25,13 @@ end ObjectSpace.each_object(TracePoint, &:disable) + + Inferno::Entities::TestSuite.descendants.each do |descendant| + # When ID not assigned in custom test suites, Runnable.id will return default ID + # equal to the custom test suite's parent class name + if descendant.id.blank? || descendant.id == 'Inferno::Entities::TestSuite' + raise StandardError, "Error initializing test suite #{descendant.name}: test suite ID is not set" + end + end end end