Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 753626b4 authored by Zimuzo's avatar Zimuzo
Browse files

Fix RollbackTest#testBadUpdateRollback

It appears that the device can be under high broadcast pressure and 5
seconds may not be a long enough wait to receive broadcast from test
app in instrumented app. We now remove the 5 seconds wait and rely on
test runner timeout to not wait forever.

Test: atest RollbackTest
Bug: 123886893 120598832
Change-Id: Ic686da15cfb64e5a84fb9f7c2795b94ef481d3bd
parent 80ced71a
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -689,7 +689,7 @@ public class RollbackTest {
                            ActivityManager am = context.getSystemService(ActivityManager.class);
                            am.killBackgroundProcesses(TEST_APP_A);
                            // Allow another package launch
                            crashQueue.offer(intent.getIntExtra("count", 0), 5, TimeUnit.SECONDS);
                            crashQueue.put(intent.getIntExtra("count", 0));
                        } catch (InterruptedException e) {
                            fail("Failed to communicate with test app");
                        }
@@ -698,14 +698,9 @@ public class RollbackTest {
            context.registerReceiver(crashCountReceiver, crashCountFilter);

            // Start apps PackageWatchdog#TRIGGER_FAILURE_COUNT times so TEST_APP_A crashes
            Integer crashCount = null;
            do {
                RollbackTestUtils.launchPackage(TEST_APP_A);
                crashCount = crashQueue.poll(5, TimeUnit.SECONDS);
                if (crashCount == null) {
                    fail("Timed out waiting for crash signal from test app");
                }
            } while(crashCount < 5);
            } while(crashQueue.take() < 5);

            // TEST_APP_A is automatically rolled back by the RollbackPackageHealthObserver
            assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));