Loading tests/RollbackTest/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ java_test_host { name: "StagedRollbackTest", srcs: ["StagedRollbackTest/src/**/*.java"], libs: ["tradefed"], static_libs: ["testng"], test_suites: ["general-tests"], test_config: "StagedRollbackTest.xml", } Loading tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java +11 −3 Original line number Diff line number Diff line Loading @@ -229,13 +229,21 @@ public class StagedRollbackTest { RollbackManager rm = RollbackUtils.getRollbackManager(); assertThat(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(), getNetworkStackPackageName())).isNotNull(); // Sleep for < health check deadline Thread.sleep(TimeUnit.SECONDS.toMillis(5)); // Verify rollback was not executed before health check deadline assertThat(getUniqueRollbackInfoForPackage(rm.getRecentlyCommittedRollbacks(), getNetworkStackPackageName())).isNull(); } @Test public void testNetworkFailedRollback_Phase3() throws Exception { RollbackManager rm = RollbackUtils.getRollbackManager(); assertThat(getUniqueRollbackInfoForPackage(rm.getRecentlyCommittedRollbacks(), getNetworkStackPackageName())).isNull(); // Sleep for > health check deadline // The device is expected to reboot during sleeping. This device method will fail and // the host will catch the assertion. If reboot doesn't happen, the host will fail the // assertion. Thread.sleep(TimeUnit.SECONDS.toMillis(260)); } @Test Loading tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java +2 −16 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.tests.rollback.host; import static org.junit.Assert.assertTrue; import static org.testng.Assert.assertThrows; import com.android.ddmlib.Log.LogLevel; import com.android.tradefed.log.LogUtil.CLog; Loading Loading @@ -136,22 +137,7 @@ public class StagedRollbackTest extends BaseHostJUnit4Test { // Verify rollback was enabled runPhase("testNetworkFailedRollback_Phase2"); // Sleep for < health check deadline Thread.sleep(5000); // Verify rollback was not executed before health check deadline runPhase("testNetworkFailedRollback_Phase3"); try { // This is expected to fail due to the device being rebooted out // from underneath the test. If this fails for reasons other than // the device reboot, those failures should result in failure of // the testNetworkFailedRollback_Phase4 phase. CLog.logAndDisplay(LogLevel.INFO, "Sleep and expect to fail while sleeping"); // Sleep for > health check deadline Thread.sleep(260000); } catch (AssertionError e) { // AssertionError is expected. } assertThrows(AssertionError.class, () -> runPhase("testNetworkFailedRollback_Phase3")); getDevice().waitForDeviceAvailable(); // Verify rollback was executed after health check deadline Loading Loading
tests/RollbackTest/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ java_test_host { name: "StagedRollbackTest", srcs: ["StagedRollbackTest/src/**/*.java"], libs: ["tradefed"], static_libs: ["testng"], test_suites: ["general-tests"], test_config: "StagedRollbackTest.xml", } Loading
tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java +11 −3 Original line number Diff line number Diff line Loading @@ -229,13 +229,21 @@ public class StagedRollbackTest { RollbackManager rm = RollbackUtils.getRollbackManager(); assertThat(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(), getNetworkStackPackageName())).isNotNull(); // Sleep for < health check deadline Thread.sleep(TimeUnit.SECONDS.toMillis(5)); // Verify rollback was not executed before health check deadline assertThat(getUniqueRollbackInfoForPackage(rm.getRecentlyCommittedRollbacks(), getNetworkStackPackageName())).isNull(); } @Test public void testNetworkFailedRollback_Phase3() throws Exception { RollbackManager rm = RollbackUtils.getRollbackManager(); assertThat(getUniqueRollbackInfoForPackage(rm.getRecentlyCommittedRollbacks(), getNetworkStackPackageName())).isNull(); // Sleep for > health check deadline // The device is expected to reboot during sleeping. This device method will fail and // the host will catch the assertion. If reboot doesn't happen, the host will fail the // assertion. Thread.sleep(TimeUnit.SECONDS.toMillis(260)); } @Test Loading
tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java +2 −16 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.tests.rollback.host; import static org.junit.Assert.assertTrue; import static org.testng.Assert.assertThrows; import com.android.ddmlib.Log.LogLevel; import com.android.tradefed.log.LogUtil.CLog; Loading Loading @@ -136,22 +137,7 @@ public class StagedRollbackTest extends BaseHostJUnit4Test { // Verify rollback was enabled runPhase("testNetworkFailedRollback_Phase2"); // Sleep for < health check deadline Thread.sleep(5000); // Verify rollback was not executed before health check deadline runPhase("testNetworkFailedRollback_Phase3"); try { // This is expected to fail due to the device being rebooted out // from underneath the test. If this fails for reasons other than // the device reboot, those failures should result in failure of // the testNetworkFailedRollback_Phase4 phase. CLog.logAndDisplay(LogLevel.INFO, "Sleep and expect to fail while sleeping"); // Sleep for > health check deadline Thread.sleep(260000); } catch (AssertionError e) { // AssertionError is expected. } assertThrows(AssertionError.class, () -> runPhase("testNetworkFailedRollback_Phase3")); getDevice().waitForDeviceAvailable(); // Verify rollback was executed after health check deadline Loading