Skip to content

Commit

Permalink
FI-2041: Custom suites with no ids now throw standard error (#387)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Combining suite ID checks into single condition

---------

Co-authored-by: Stephen MacVicar <[email protected]>
  • Loading branch information
alisawallace and Jammjammjamm authored Aug 31, 2023
1 parent 516a1ab commit ec2d182
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-darwin-20
x86_64-darwin-22
x86_64-linux

DEPENDENCIES
Expand Down
8 changes: 8 additions & 0 deletions lib/inferno/config/boot/suites.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ec2d182

Please sign in to comment.