-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FI-3182 Inferno execute unified short ids option #540
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #540 +/- ##
=======================================
Coverage 84.08% 84.08%
=======================================
Files 261 261
Lines 11392 11392
Branches 1252 1252
=======================================
Hits 9579 9579
Misses 1803 1803
Partials 10 10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
lib/inferno/apps/cli/execute.rb
Outdated
end | ||
end | ||
|
||
def shorts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this isn't called short_ids
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its returning the actual test entities instead of ids.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, this method name makes no sense.
lib/inferno/apps/cli/execute.rb
Outdated
@@ -201,11 +266,11 @@ def print_error_and_exit(err, code) | |||
end | |||
|
|||
def runnable_type(runnable) | |||
if Inferno::TestSuite.subclasses.include? runnable | |||
if Inferno::TestSuite.subclasses.include?(runnable) || runnable.ancestors.include?(Inferno::TestSuite) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if runnable < Inferno::TestSuite
lib/inferno/apps/cli/execute.rb
Outdated
# Since Inferno can only have one test_run executing at a time per test_session, | ||
# and each call to `inferno execute` represents one test_session, we block until | ||
# each runnable until result is achieved | ||
block_until_result_for(runnable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are tests running asynchronously? Why does the short id require this change, wasn't this exact behavior already available just using test ids and group ids rather short ids?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad I mixed up executing test_run with instantiating test run. Yes jobs are already running synchronously and this is now removed.
lib/inferno/apps/cli/execute.rb
Outdated
# sort so if a user specifies `inferno execute --tests 1.01 --short-ids 1.02` it will run in order 1.01, 1.02 | ||
# although this will disallow if a user wanted to intentionally run `inferno execute --tests 1.02 1.01` in | ||
# that order | ||
@selected_runnables ||= validate_unique_runnables(shorts + groups + tests).sort do |a, b| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should sort, I think we should execute things in the order specified by the user.
lib/inferno/apps/cli/execute.rb
Outdated
@@ -165,6 +191,41 @@ def dispatch_job(test_run) | |||
end | |||
end | |||
|
|||
def validate_unique_runnables(runnables) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we care to validate this? Why should this prevent someone from running tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was glitchy behavior observed when a user tried to run the same test entity multiple times in one execute call. It may relate to the fact that Inferno core will create a result
once all the children of a test entity have a result, but I haven't exactly proved it's due to that. It's easier to prevent this behavior than fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get that the Inferno REST API allows re-running the same entity over one session, and one execute call is reflecting one session, but the client also blocks spamming requests and possibly filters the results returned. When we tackle the other bug or give inferno execute
more control over sessions we can re-enable this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or I could undo it and leave the sharp tools with the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was glitchy behavior observed when a user tried to run the same test entity multiple times in one execute call. It may relate to the fact that Inferno core will create a result once all the children of a test entity have a result, but I haven't exactly proved it's due to that. It's easier to prevent this behavior than fix it.
This change is similar to the async test execution change where it doesn't seem related to the purpose of the ticket. We should connect and discuss problem this is intended to prevent, because I'm willing to bet that the fix is simpler than this code.
lib/inferno/apps/cli/execute.rb
Outdated
|
||
@shorts ||= options[:short_ids]&.map do |short_id| | ||
find_by_short_id(test_groups_repo, short_id) | ||
rescue StandardError => maybe_not_found_error # rubocop:disable Naming/RescuedExceptionsVariableName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find_by_short_id
should do what it says without requiring rescuing errors.
…erno-core into fi-3182-clean-diff
Updated testing guidance
|
lib/inferno/apps/cli/execute.rb
Outdated
@@ -165,23 +172,54 @@ def dispatch_job(test_run) | |||
end | |||
end | |||
|
|||
def runnable_is_included_in?(runnable, maybe_parent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dead code now, right?
lib/inferno/apps/cli/execute.rb
Outdated
run_one(suite, test_run) | ||
|
||
# TODO: make results more intuitively ordered than just reversing | ||
results = test_runs_repo.results_for_test_run(test_run.id).reverse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and in line 55, replace reverse with:
.sort { |result, other| result.runnable.short_id <=> other.runnable.short_id }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked for this change here and in lines 49 and 55 (now 48 and 54). Making the change in line 62 is not the same behavior and is not correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because rubocop says that this hits the cyclomatic complexity limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also suites don't have short ids so I had to make those if
statements. Suites appear last my implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would actually argue to raise or disable the cyclomatic complexity limit in rubocop, but decided I'll ask that in a future PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the behavior is wrong.
loop do
results += results.sort
end
results
is not the same as
loop do
results += results
end
results.sort
Suites should also definitely come first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
results += results.sort
is the desired behavior right?
Okay behavior should be correct now |
Summary
Create command line option that allows for unified short ids
--short-ids
(alias:-r
)Testing GuidanceSee Belowbundle exec inferno services start