Bug 1271000 - Add explanation of potential test failures in TestClientsEngineStage. r=sebastian draft
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 25 May 2016 11:03:55 -0700
changeset 370988 1c2b09e46aace0975c89f6692de7a255a822d68d
parent 370954 bbd294728ecc2f4e5e838764e589220e7c288f92
child 521875 24bd395fae0e1972f8eba245d7f0cb10e2ace5ef
push id19194
push usermichael.l.comella@gmail.com
push dateWed, 25 May 2016 18:03:19 +0000
reviewerssebastian
bugs1271000
milestone49.0a1
Bug 1271000 - Add explanation of potential test failures in TestClientsEngineStage. r=sebastian MozReview-Commit-ID: 98KOJvB3IXC
mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestClientsEngineStage.java
--- 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();