From a09e3c09832912c649e343b8486e0951457551f7 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Tue, 24 Mar 2020 16:09:58 +0800 Subject: [PATCH] Fix a flaky test It is possible to have multiple committed rollbacks which include the same app. Uninstalling an app will delete committed rollbacks which include the app. However, there is a race condition between when the app is uninstalled and when rollback manager deletes the rollback as is stated here: https://cs.corp.google.com/android/frameworks/base/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java?rcl=75dfeca3d40624b745f41155aa38bc5e3fa405fe&l=116 We hit the assertion in #getUniqueRollbackInfoForPackage when there are multiple rollbacks including the same package which is caused by the race condition above. Let's rewrite the code by calling #hasRollbackInclude instead which will not throw. Also do some cleanup in the xml to improve the isolation of our tests. Bug: 152271716 Test: atest RollbackTest Change-Id: Iad3effe52db2a0d2d5e3914bcd08ed93926f3fd3 --- tests/RollbackTest/RollbackTest.xml | 4 ++++ .../com/android/tests/rollback/RollbackTest.java | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/RollbackTest/RollbackTest.xml b/tests/RollbackTest/RollbackTest.xml index 269cec1ccca9b..7b85cc84f1f58 100644 --- a/tests/RollbackTest/RollbackTest.xml +++ b/tests/RollbackTest/RollbackTest.xml @@ -23,6 +23,10 @@