-
Notifications
You must be signed in to change notification settings - Fork 232
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
Added a few more tests to mock test failure scenarios and fixed a few final Exit Status issues #430
Added a few more tests to mock test failure scenarios and fixed a few final Exit Status issues #430
Conversation
bc7082b
to
34303d9
Compare
@ob @chenxiao0228 Let me fix the failing test. Please hold on reviewing this. |
b402188
to
619448d
Compare
c3783a8
to
ae4e96c
Compare
@ob @chenxiao0228 This is ready for review. Can you please take a look? |
ae4e96c
to
d83a498
Compare
@oliverhu Can you please review this and let me know your comments? Thanks. \cc @chenxiao0228 @ob |
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.
thx for adding tests!
hey @ravimandala , actually the test time jumped from 20 minutes to ONE HOUR? https://github.com/linkedin/bluepill/runs/528445755 |
@oliverhu The new tests added ~27 minutes. Most of it is simulator recreation for retries. I will try to reduce the test_timeouts/stuck_timeouts if possible.
|
Changing the Exit Status to powers of 2 to make them mergable. Easy consolidation/aggregation of exit code. In case of failure reporting, report all exit status that happened over multiple attempts, if any. Prevent extra attempt, which does nothing, by eliminating the use of `hasRemainingTestsInContext` which is not accurate.
… test A fragile packer test broke when the total number of tests changed. So, fixed the testing method to fix the test. Also, re-enabled a few tests in BluepillTests that were being skipped/disbaled for some reason.
f4d812a
to
85fd74b
Compare
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.
Cool... I especially like the new tests.
Can we document the new behavior that app crashes are considered fatal and even if tests pass on retry the exit status is app crashed? Maybe in the failure tolerance arg docs?
This is a really good clean up. Thank you.
3698e33
to
d3331ae
Compare
Renaming the all-good exit status from BPExitStatusTestsAllPassed to BPExitStatusAllTestsPassed and incorporated comments. Tweaked the tests a bit to reduce the regression testing duration.
d3331ae
to
57dd419
Compare
Thanks, @oliverhu. Merging it now. |
… final Exit Status issues (MobileNativeFoundation#430) * Adding the ability to mock different test executions in Bluepill * Add a few more tests and fixed the exit status issues Changing the Exit Status to powers of 2 to make them mergeable. Easy consolidation/aggregation of exit code. In case of failure reporting, report all exit status that happened over multiple attempts, if any. Prevent extra attempt, which does nothing, by eliminating the use of `hasRemainingTestsInContext` which is not accurate. * Re-enabling some disabled/skipped BP tests and fixed a fragile packer test A fragile packer test broke when the total number of tests changed. So, fixed the testing method to fix the test. Also, re-enabled a few tests in BluepillTests that were being skipped/disabled for some reason. * Renaming BPExitStatusTestsAllPassed to BPExitStatusAllTestsPassed Renaming the all-good exit status from BPExitStatusTestsAllPassed to BPExitStatusAllTestsPassed and incorporated comments. Tweaked the tests a bit to reduce the regression testing duration.
* make retry checks more resilient to prevent infinite retries (#432) Also, log when retry count exceeded max retries. Co-authored-by: Mansfield Mark <mmark@pinterest.com> * Added a few more tests to mock test failure scenarios and fixed a few final Exit Status issues (#430) * Adding the ability to mock different test executions in Bluepill * Add a few more tests and fixed the exit status issues Changing the Exit Status to powers of 2 to make them mergeable. Easy consolidation/aggregation of exit code. In case of failure reporting, report all exit status that happened over multiple attempts, if any. Prevent extra attempt, which does nothing, by eliminating the use of `hasRemainingTestsInContext` which is not accurate. * Re-enabling some disabled/skipped BP tests and fixed a fragile packer test A fragile packer test broke when the total number of tests changed. So, fixed the testing method to fix the test. Also, re-enabled a few tests in BluepillTests that were being skipped/disabled for some reason. * Renaming BPExitStatusTestsAllPassed to BPExitStatusAllTestsPassed Renaming the all-good exit status from BPExitStatusTestsAllPassed to BPExitStatusAllTestsPassed and incorporated comments. Tweaked the tests a bit to reduce the regression testing duration. Co-authored-by: Mansfield Mark <RainNapper@users.noreply.github.com> Co-authored-by: Mansfield Mark <mmark@pinterest.com>
…ed a few final Exit Status issues (MobileNativeFoundation#430)" This reverts commit 1cad980.
* master: Reference libXCTestBundleInject.dylib only if it exists (MobileNativeFoundation#460) Record video using simctl (MobileNativeFoundation#441) Xcode 12.0 support (MobileNativeFoundation#458) Retry app crash tests and consider then non-fatal if they pass (MobileNativeFoundation#456) Do not retry crashed tests (MobileNativeFoundation#443) Fixing minor issues and doing some minor refactoring/clean-up (MobileNativeFoundation#444) Xcode 11.5 support (MobileNativeFoundation#447) Xcode 11.4 support (MobileNativeFoundation#446) Add a flag to disable Xcode version check failure (MobileNativeFoundation#436) Support sidecar applications (MobileNativeFoundation#438) Added a few more tests to mock test failure scenarios and fixed a few final Exit Status issues (MobileNativeFoundation#430) make retry checks more resilient to prevent infinite retries (MobileNativeFoundation#432) Xcode 11.3 support (MobileNativeFoundation#426) Supporting tests and app hosts in subfolders (MobileNativeFoundation#419) # Conflicts: # bp/src/SimulatorHelper.m # bp/tests/SimulatorHelperTests.m
When a test times out, fails, crashes the app or successfully passes the bundle exits with an appropriate exit status. Often times, one or more tests in the bundle can exhibit one or more of these behaviors in one single execution of a test bundle. However, the testing of this part of Bluepill's logic is limited right now partially because the combinations are exponential. Another reason is the lack of an easy-to-use mechanism to reproduce/mock different scenarios.
This PR is an attempt to add that ability along with a bunch of new tests and fix any bugs discovered.
With the new ability to test multiple cascading failure scenarios, a few more tests were added to uncover some known issues in exit status.
Bluepill tries to merge exit statuses with a
|
operator but since the exit status codes are not mergeable it is resulting in unexpected behavior. For example, if a bundle hasBPExitStatusTestsFailed
andBPExitStatusTestTimeout
, then the final exit status is returned asBPExitStatusAppCrashed
because6 | 1 = 7
.Fix: Change the Exit Status codes to powers of 2 to make them mergeable.
The exit status codes are not always merged in the same way making it difficult and complicated to predict the behavior.
Solution: Simplified the Exit Status consolidation/aggregation logic. In case of failure, report all exit statuses that happened over multiple attempts.
The
hasRemainingTestsInContext()
is not capable of delivering the exact precise answer to the question... Are there more tests left to execute? partially because of a known issue (Bluepill's list of tests is not the same as the list of tests that get executed #352). So, depending on that is sometimes leading to an extra simulator attempt even after there are no tests left to execute.Fix: Considering the return of
BPExitStatusTestsAllPassed
an indication from Simulator that "all tests there are to execute are done". Another indication to end testing is when certain error occur and there are no more retries left.\cc @ob @chenxiao0228