Assert there is only one data folder created during test (1/n)
See b/170689774#comment2. If the assertion fails, it will log the content of the 'after' list which gives us more information for debugging. Bug: 170689774 Test: atest StagedRollbackTest Change-Id: Ib4ccd1be6f39c1d4c2556cbf6a06cfdf14240220
This commit is contained in:
@@ -18,6 +18,8 @@ package com.android.tests.rollback.host;
|
||||
|
||||
import static com.android.tests.rollback.host.WatchdogEventLogger.watchdogEventOccurred;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -272,6 +274,8 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
|
||||
List<String> after = getSnapshotDirectories("/data/misc_ce/0/rollback");
|
||||
// Only check directories newly created during the test
|
||||
after.removeAll(before);
|
||||
// There should be only one /data/misc_ce/0/rollback/<rollbackId> created during test
|
||||
assertThat(after).hasSize(1);
|
||||
after.forEach(dir -> assertDirectoryIsEmpty(dir));
|
||||
}
|
||||
|
||||
@@ -358,6 +362,8 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
|
||||
List<String> after = getSnapshotDirectories("/data/misc/apexrollback");
|
||||
// Only check directories newly created during the test
|
||||
after.removeAll(before);
|
||||
// There should be only one /data/misc/apexrollback/<rollbackId> created during test
|
||||
assertThat(after).hasSize(1);
|
||||
after.forEach(dir -> assertDirectoryIsEmpty(dir));
|
||||
}
|
||||
|
||||
@@ -405,6 +411,8 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
|
||||
List<String> after = getSnapshotDirectories("/data/misc_de/0/apexrollback");
|
||||
// Only check directories newly created during the test
|
||||
after.removeAll(before);
|
||||
// There should be only one /data/misc_de/0/apexrollback/<rollbackId> created during test
|
||||
assertThat(after).hasSize(1);
|
||||
after.forEach(dir -> assertDirectoryIsEmpty(dir));
|
||||
}
|
||||
|
||||
@@ -450,6 +458,8 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
|
||||
List<String> after = getSnapshotDirectories("/data/misc_ce/0/apexrollback");
|
||||
// Only check directories newly created during the test
|
||||
after.removeAll(before);
|
||||
// There should be only one /data/misc_ce/0/apexrollback/<rollbackId> created during test
|
||||
assertThat(after).hasSize(1);
|
||||
after.forEach(dir -> assertDirectoryIsEmpty(dir));
|
||||
}
|
||||
|
||||
@@ -509,6 +519,8 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
|
||||
List<String> after = getSnapshotDirectories("/data/misc_ce/0/apexrollback");
|
||||
// Only check directories newly created during the test
|
||||
after.removeAll(before);
|
||||
// There should be only one /data/misc_ce/0/apexrollback/<rollbackId> created during test
|
||||
assertThat(after).hasSize(1);
|
||||
// Expire all rollbacks and check CE snapshot directories are deleted
|
||||
runPhase("testCleanUp");
|
||||
for (String dir : after) {
|
||||
|
||||
Reference in New Issue
Block a user