Bug 1271000 - Add explanation of potential test failures in TestClientsEngineStage. r=sebastian
MozReview-Commit-ID: 98KOJvB3IXC
--- a/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestClientsEngineStage.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestClientsEngineStage.java
@@ -51,16 +51,25 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+/**
+ * Some tests in this class run client/server multi-threaded code but JUnit assertions triggered
+ * from background threads do not fail the test. If you see unexplained connection-related test failures,
+ * an assertion on the server may have been thrown. Unfortunately, it is non-trivial to get the background
+ * threads to transfer failures back to the test thread so we leave the tests in this state for now.
+ *
+ * One reason the server might throw an assertion is if you have not installed the crypto policies. See
+ * https://wiki.mozilla.org/Mobile/Fennec/Android/Testing#JUnit4_tests for more information.
+ */
@RunWith(TestRunner.class)
public class TestClientsEngineStage extends MockSyncClientsEngineStage {
public final static String LOG_TAG = "TestClientsEngSta";
public TestClientsEngineStage() throws SyncConfigurationException, IllegalArgumentException, NonObjectJSONException, IOException, CryptoException, URISyntaxException {
super();
session = initializeSession();
}
@@ -596,17 +605,17 @@ public class TestClientsEngineStage exte
// Body and header are the same.
assertEquals(Utils.decimalSecondsToMilliseconds(uploadBodyTimestamp),
session.config.getPersistedServerClientsTimestamp());
assertEquals(uploadedRecord.lastModified,
session.config.getPersistedServerClientRecordTimestamp());
assertEquals(uploadHeaderTimestamp, session.config.getPersistedServerClientsTimestamp());
}
- @Test
+ @Test // client/server multi-threaded
public void testDownloadHasOurRecord() {
// Make sure no upload occurs after a download so we can
// test download in isolation.
stubUpload = true;
// We've uploaded our local record recently.
long initialTimestamp = setRecentClientRecordTimestamp();