Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Fix a AppLifecycleTest present time race between the animation and the rest of the test #21107

Merged
merged 12 commits into from
Sep 14, 2020

Conversation

xster
Copy link
Member

@xster xster commented Sep 11, 2020

This PR fixes the following:

Re-enable tests after flutter/flutter#61620

There was previously no gate on the no animation vc present. There was a chance that more code could concurrently run between viewWillAppear and viewDidAppear which produces indeterministic behavior.

There was also a chance that AppLifecycleTest is the first test to run. When that happens, there's a chance that UIApplication's application state is UIApplicationStateInactive (couldn't repro locally but happens on LUCI). The UIApplicationStateInactive->UIApplicationStateActive transition could happen in the test which is problematic since AppLifecycleTest asserts all lifecycle transitions.

I wasn't able to force it to transition first during setup and wait, so I just accounted for this possible extra transition in the test.

The special casing seems to have worked in https://logs.chromium.org/logs/flutter/led/xster_google.com/18a0dadc0f7e51e15dbbbe4666b2392ad20e6226b1050c54435b83902e90f2bf/+/steps/Scenario_App_Integration_Tests/0/stdout, https://logs.chromium.org/logs/flutter/led/xster_google.com/3449f1df356e5fce74d34bb2e783ccd9f2eba95b9911a0f23357162a096376a9/+/steps/Scenario_App_Integration_Tests/0/stdout, https://logs.chromium.org/logs/flutter/led/xster_google.com/a6de2ad7906874242d6b596eaf1431e9ac72cb61640045744ce14af7b614d3d4/+/steps/Scenario_App_Integration_Tests/0/stdout.

Try 38681f4:
https://chromium-swarm.appspot.com/task?id=4e9721417a406210
https://chromium-swarm.appspot.com/task?id=4e97216ddf9d1b10
https://chromium-swarm.appspot.com/task?id=4e9721ef95a11710
https://chromium-swarm.appspot.com/task?id=4e972212b205be10
https://chromium-swarm.appspot.com/task?id=4e97223052766810
https://chromium-swarm.appspot.com/task?id=4e97225071f95110

Try c3bfbae:
https://chromium-swarm.appspot.com/task?id=4e97346c68408510
https://chromium-swarm.appspot.com/task?id=4e97358268469b10
https://chromium-swarm.appspot.com/task?id=4e97358968662010
https://chromium-swarm.appspot.com/task?id=4e973591eeb23f10
https://chromium-swarm.appspot.com/task?id=4e97359939a0e610
https://chromium-swarm.appspot.com/task?id=4e9735a1c4213810
https://chromium-swarm.appspot.com/task?id=4e9735ab39586c10
https://chromium-swarm.appspot.com/task?id=4e9735b4eb48f410
https://chromium-swarm.appspot.com/task?id=4e9735bc75d50f10

Try fb75e54:
https://chromium-swarm.appspot.com/task?id=4e97642f08353010
https://chromium-swarm.appspot.com/task?id=4e97643887800f10
https://chromium-swarm.appspot.com/task?id=4e97644154c88f10
https://chromium-swarm.appspot.com/task?id=4e97644b716a2510
https://chromium-swarm.appspot.com/task?id=4e976455d4d18810
https://chromium-swarm.appspot.com/task?id=4e97645f1c875810
https://chromium-swarm.appspot.com/task?id=4e9764660d917a10
https://chromium-swarm.appspot.com/task?id=4e97646e65d20c10

Try bebce3d:
https://chromium-swarm.appspot.com/task?id=4e97f4f8ca6e5210
https://chromium-swarm.appspot.com/task?id=4e97f4ff341ef010
https://chromium-swarm.appspot.com/task?id=4e97f50e72eb1510
https://chromium-swarm.appspot.com/task?id=4e97f51dc07e3d10
https://chromium-swarm.appspot.com/task?id=4e97f5255604d310
https://chromium-swarm.appspot.com/task?id=4e97f52e46ef2d10
https://chromium-swarm.appspot.com/task?id=4e97f53a22042110
https://chromium-swarm.appspot.com/task?id=4e97f541f218bd10

Try c28013a:
https://chromium-swarm.appspot.com/task?id=4e980e9a88ca8410
https://chromium-swarm.appspot.com/task?id=4e980ea26762a510
https://chromium-swarm.appspot.com/task?id=4e980eaa990d1010
https://chromium-swarm.appspot.com/task?id=4e980eb303239210
https://chromium-swarm.appspot.com/task?id=4e980ebb546b0f10
https://chromium-swarm.appspot.com/task?id=4e980ec444f57810
https://chromium-swarm.appspot.com/task?id=4e980eceaf85ad10
https://chromium-swarm.appspot.com/task?id=4e980ed81654d010

Make double sure:
https://chromium-swarm.appspot.com/task?id=4e9826dfc8328010
https://chromium-swarm.appspot.com/task?id=4e9826e81e2d7b10
https://chromium-swarm.appspot.com/task?id=4e9826eeb3d9f810
https://chromium-swarm.appspot.com/task?id=4e9826f5f0026c10
https://chromium-swarm.appspot.com/task?id=4e9826fc87bcd210
https://chromium-swarm.appspot.com/task?id=4e98270339b54110
https://chromium-swarm.appspot.com/task?id=4e982709b72fe610
https://chromium-swarm.appspot.com/task?id=4e98271092735110
https://chromium-swarm.appspot.com/task?id=4e982716a0685110
https://chromium-swarm.appspot.com/task?id=4e98271daf10b310

try 7c6573c (increase initial timeout):
https://chromium-swarm.appspot.com/task?id=4e98424e76c40710
https://chromium-swarm.appspot.com/task?id=4e98425520420b10
https://chromium-swarm.appspot.com/task?id=4e98425b483f2c10
https://chromium-swarm.appspot.com/task?id=4e984262e1bf0710
https://chromium-swarm.appspot.com/task?id=4e98426dc089e610
https://chromium-swarm.appspot.com/task?id=4e984278cbe01f10
https://chromium-swarm.appspot.com/task?id=4e9842835ba8bd10
https://chromium-swarm.appspot.com/task?id=4e98428bea733a10
https://chromium-swarm.appspot.com/task?id=4e9842971061ca10
https://chromium-swarm.appspot.com/task?id=4e98429ea458d710
https://chromium-swarm.appspot.com/task?id=4e9842a509cfe710
https://chromium-swarm.appspot.com/task?id=4e9842acb942cb10
https://chromium-swarm.appspot.com/task?id=4e9842b49795a710
https://chromium-swarm.appspot.com/task?id=4e9842bb0515bf10
https://chromium-swarm.appspot.com/task?id=4e9842c17ed07010
https://chromium-swarm.appspot.com/task?id=4e9842c92aa8d210
https://chromium-swarm.appspot.com/task?id=4e9842d0c5d36c10
https://chromium-swarm.appspot.com/task?id=4e9842d6f5876f10
https://chromium-swarm.appspot.com/task?id=4e9842dd79b46410
https://chromium-swarm.appspot.com/task?id=4e9842e42f573110

try 624f2fc (wait for application state after setting root vc):
https://chromium-swarm.appspot.com/task?id=4e98818bde1dd810
https://chromium-swarm.appspot.com/task?id=4e988192ea1f7e10
https://chromium-swarm.appspot.com/task?id=4e98819ad70f1510
https://chromium-swarm.appspot.com/task?id=4e9881a1ca894810
https://chromium-swarm.appspot.com/task?id=4e9881a8e4e6ce10
https://chromium-swarm.appspot.com/task?id=4e9881b14ddf7110
https://chromium-swarm.appspot.com/task?id=4e9881b949743f10
https://chromium-swarm.appspot.com/task?id=4e9881c1177c3c10
https://chromium-swarm.appspot.com/task?id=4e9881c8266a0010
https://chromium-swarm.appspot.com/task?id=4e9881d27820c610

try 334e1db (use keyValueObservingExpectationForObject instead):
https://chromium-swarm.appspot.com/task?id=4e99cefe08c92210
https://chromium-swarm.appspot.com/task?id=4e99cf0904c90110
https://chromium-swarm.appspot.com/task?id=4e99cf102fd11510
https://chromium-swarm.appspot.com/task?id=4e99cf189050cb10
https://chromium-swarm.appspot.com/task?id=4e99cf216166cb10
https://chromium-swarm.appspot.com/task?id=4e99cf27c769db10
https://chromium-swarm.appspot.com/task?id=4e99e02fa46b8810
https://chromium-swarm.appspot.com/task?id=4e99e0396bc33110
https://chromium-swarm.appspot.com/task?id=4e99e041f6438f10
https://chromium-swarm.appspot.com/task?id=4e99e049691bc410
https://chromium-swarm.appspot.com/task?id=4e99e05105783f10
https://chromium-swarm.appspot.com/task?id=4e99e0593f78f210

try 61e8b35 (instead of waiting which doesn't seem to work, just account for the event):
https://chromium-swarm.appspot.com/task?id=4e99eca25a037e10
https://chromium-swarm.appspot.com/task?id=4e99ecaa3e7f6110
https://chromium-swarm.appspot.com/task?id=4e99ecb096d57010
https://chromium-swarm.appspot.com/task?id=4e99ecb7022f5010
https://chromium-swarm.appspot.com/task?id=4e99ecbe13a35e10
https://chromium-swarm.appspot.com/task?id=4e99ecc4dc5a9b10
https://chromium-swarm.appspot.com/task?id=4e99ecccfdadb410
https://chromium-swarm.appspot.com/task?id=4e99ecd3a5c08510
https://chromium-swarm.appspot.com/task?id=4e99ecdbbf602810
https://chromium-swarm.appspot.com/task?id=4e99ece23b0daa10
https://chromium-swarm.appspot.com/task?id=4e99ece850fe9810
https://chromium-swarm.appspot.com/task?id=4e99ecef6ba06e10

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@xster xster marked this pull request as draft September 11, 2020 17:56
@auto-assign auto-assign bot requested a review from iskakaushik September 11, 2020 17:56
@xster xster removed the request for review from iskakaushik September 11, 2020 17:57
@xster xster marked this pull request as ready for review September 11, 2020 19:50
@xster xster requested review from cbracken and gaaclarke September 11, 2020 19:51
@xster xster changed the title Debug AppLifecycleTest Fix a AppLifecycleTest present time race between the animation and the rest of the test Sep 11, 2020
@xster xster added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Sep 11, 2020
@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Mac iOS Engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Sep 11, 2020
@@ -39,11 +39,11 @@ - (void)viewDidLoad {
[_engine runWithEntrypoint:nil];
}

- (FlutterViewController*)showFlutter {
- (FlutterViewController*)showFlutter:(void (^)(void))showCompletion {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi you can just say dispatch_block_t

@xster
Copy link
Member Author

xster commented Sep 11, 2020

Last try no good. When AppLifecycleTest is the first scenario test to run, the application state is in UIApplicationStateInactive. Can't just start to test since if the UIApplicationStateInactive->UIApplicationStateActive transition happens in the test, it'll pollute. Can't just wait since sometimes it never starts without more actions in the test.

Probably need to start a dummy UIViewController first to poke at it if needed.

@xster
Copy link
Member Author

xster commented Sep 12, 2020

k, I think I finally got this working in the last 12/12 (with 3 hitting the previously problematic sequence).

I'll submit this Monday morning so it doesn't crap out when I'm out.

@xster xster added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Sep 14, 2020
@xster
Copy link
Member Author

xster commented Sep 14, 2020

Merging to kick purple bot

@xster xster merged commit 257eba9 into flutter:master Sep 14, 2020
@xster xster deleted the debug-applifecycletest branch September 14, 2020 15:50
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes platform-ios waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants