-
Notifications
You must be signed in to change notification settings - Fork 28.8k
Add flag to disable automatic device reboot for DeviceLab tests #164184
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
dev/devicelab/bin/run.dart
Outdated
@@ -75,6 +75,9 @@ Future<void> main(List<String> rawArgs) async { | |||
/// Use an emulator for this test if it is an android test. | |||
final bool useEmulator = (args['use-emulator'] as bool?) ?? false; | |||
|
|||
/// Do not attempt to reboot device. |
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.
Maybe it would be valuable to emphasise the nature of the reboot - that it is a regular automatic reboot based on total amount of tests run on this specific device.
/// Do not attempt to reboot device. | |
/// Do not automatically reboot the device after a certain number of tests. | |
/// In LUCI, every device is automatically restarted after a set number of tests. | |
/// Disabling the automatic reboot can be useful when running tests locally in a loop. |
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.
Good suggestion, included
dev/devicelab/bin/run.dart
Outdated
@@ -75,6 +75,9 @@ Future<void> main(List<String> rawArgs) async { | |||
/// Use an emulator for this test if it is an android test. | |||
final bool useEmulator = (args['use-emulator'] as bool?) ?? false; | |||
|
|||
/// Do not attempt to reboot device. | |||
final bool noReboot = (args['no-reboot'] as bool?) ?? false; |
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.
Just a nitpick - maybe the command line flag name can be improved for something even more descriptive?
- "disable-reboot"
- "disable-automatic-reboot"
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.
Good suggestion, using disable-reboot now
dev/devicelab/bin/run.dart
Outdated
'no-reboot', | ||
negatable: false, | ||
help: | ||
'Do not attempt to reboot the device after every 30 test runs', |
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 like the help message. Just wondering if we should write the 30 in here or try to avoid it and say something like
'Do not attempt to reboot the device after every 30 test runs', | |
'Do not automatically reboot the device after a certain number of 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.
Good suggestion
@@ -238,7 +241,9 @@ class _TaskRunner { | |||
print(stackTrace); | |||
return TaskResult.failure('Task timed out after $taskTimeout'); | |||
} finally { | |||
await checkForRebootRequired(); | |||
if (!noReboot){ |
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.
The double negative here can be hard to read IMHO. Maybe flip the variable and use something like:
if (!noReboot){ | |
if (!rebootAutomatically){ |
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.
The negating is influenced by existing default logic, which cannot be changed (reboot by default). Removing the negating here means the negation will be some level up in the code call stack, so it doesn't really improve the readablity. Keeping it as it is.
Let's also update the DeviceLab Readme at dev/devicelab/README.md and
|
One additional note (no action needed) - I personally do not like the naming of the "-exit" flag. It is misleading and hard to understand. |
Also did a quick test - works as expected ✅
|
f28c10e
to
ffa717f
Compare
ffa717f
to
609c72a
Compare
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
Hey @harri35, do you want to continue working on this PR? |
Hei @Piinks! At the time of creation, the change here seemed like a good idea and something that would be needed going forward. Now I am not sure anymore :) Is this valuable for the community? As this was originally Ergo's contribution, I'll also ask Ergo's opinion and get back to you. Sorry about leaving this hanging here like this. I needed to jump on another thing, and then promptly forgot about this. |
Thanks for the explanation! I will defer to @matanlurey if this is an infra change we want to make. |
The need for this PR raised from the assumption that we can work with flaky tests locally by running test repeatedly hundreds or thousand of times. IIRC we were able to trigger flakiness with this method in 1 or 2 cases only and still not reproducible all the time. Most (if not all) flakiness was related to running tests in the CI infra, rendering the approach of working with flakes actually useless. Therefore I think this change is not needed any more - there are simply no consumers of the functionality. |
Fixes #164486
NOTE: @ergosarapu is the author of the pull request and the changes. I just ended up creating it so I could give some early feedback.
Pre-launch Checklist
///
).