Merge "Reenable ProjectWatchIT"
This commit is contained in:
		@@ -1,15 +1,7 @@
 | 
			
		||||
include_defs('//gerrit-acceptance-tests/tests.defs')
 | 
			
		||||
 | 
			
		||||
FLAKY_TEST_CASES=['ProjectWatchIT.java']
 | 
			
		||||
 | 
			
		||||
acceptance_tests(
 | 
			
		||||
  group = 'server_project',
 | 
			
		||||
  srcs = glob(['*IT.java'], excludes=FLAKY_TEST_CASES),
 | 
			
		||||
  srcs = glob(['*IT.java']),
 | 
			
		||||
  labels = ['server'],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
acceptance_tests(
 | 
			
		||||
  group = 'server_project_flaky',
 | 
			
		||||
  srcs = FLAKY_TEST_CASES,
 | 
			
		||||
  labels = ['server', 'flaky'],
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -32,64 +32,6 @@ import java.util.List;
 | 
			
		||||
 | 
			
		||||
@NoHttpd
 | 
			
		||||
public class ProjectWatchIT extends AbstractDaemonTest {
 | 
			
		||||
  /**
 | 
			
		||||
   * Tests message project watches on new patch sets
 | 
			
		||||
   * <p>
 | 
			
		||||
   * As of 2015-06-21 this test is marked flaky for triggering race
 | 
			
		||||
   * conditions between indexing and project watches filters as
 | 
			
		||||
   * of 2015-06-21.
 | 
			
		||||
   * <p>
 | 
			
		||||
   * The test $SOMETIMES fails, stating that 2 emails instead of only
 | 
			
		||||
   * 1 got sent. The root issue is the inserting of two patch sets
 | 
			
		||||
   * (one shortly after the other), where the first patch set would
 | 
			
		||||
   * not match a user's filter while the second one would.
 | 
			
		||||
   * <p>
 | 
			
		||||
   * The test basically:
 | 
			
		||||
   * <ol>
 | 
			
		||||
   *   <li>Sets up a watch on the text 'sekret' in the commit message.</li>
 | 
			
		||||
   *   <li>Pushes a change without sekret in the commit message (no
 | 
			
		||||
   *     email is expected). (We'll refer to this as PS1)</li>
 | 
			
		||||
   *   <li>Push another patch set to the same change with sekret in the
 | 
			
		||||
   *     commit message (1 email is expected). (We'll refer to this as PS2)</li>
 | 
			
		||||
   *   <li>[...]</li>
 | 
			
		||||
   * </ol>
 | 
			
		||||
   * <p>The expected flow of actions for step 2+3 is:
 | 
			
		||||
   * <pre>
 | 
			
		||||
   *    (i) Write PS1 to the index
 | 
			
		||||
   *   (ii) Send out emails for PS1 after checking project watches from
 | 
			
		||||
   *        fresh ChangeData
 | 
			
		||||
   *  (iii) Write PS2 to the index
 | 
			
		||||
   *   (iv) Send out emails for PS2 after checking project watches from
 | 
			
		||||
   *        fresh ChangeData
 | 
			
		||||
   * </pre>
 | 
			
		||||
   * <p>
 | 
			
		||||
   * But as step (ii) and step (iv) happen on separate threads, steps
 | 
			
		||||
   * (ii) and (iii) might get turned around and become:
 | 
			
		||||
   * <pre>
 | 
			
		||||
   *   * Write PS1 to the index
 | 
			
		||||
   *   * Write PS2 to the index
 | 
			
		||||
   *   * Send out emails for PS1 after checking project watches from
 | 
			
		||||
   *     fresh ChangeData
 | 
			
		||||
   *   * Send out emails for PS2 after checking project watches from
 | 
			
		||||
   *     fresh ChangeData
 | 
			
		||||
   * </pre>
 | 
			
		||||
   * <p>
 | 
			
		||||
   * Hence, the filters for project watches for the emails for PS1 query
 | 
			
		||||
   * the index after PS2 has already been written there. Hence, the
 | 
			
		||||
   * filters for PS1 use the commit message of PS2 when filtering on
 | 
			
		||||
   * 'message:sekret'.
 | 
			
		||||
   * <p>
 | 
			
		||||
   * Since in the ProjectWatchIT test, PS2 contains 'sekret', the filters
 | 
			
		||||
   * for sending out emails for PS1 see a commit message containing
 | 
			
		||||
   * 'sekret', and the watches match for both PS1 and PS2, although they
 | 
			
		||||
   * should only match for PS2.
 | 
			
		||||
   * <p>
 | 
			
		||||
   * This explains why the test is only failing sometimes, and also why it
 | 
			
		||||
   * is more likely to occur when the system is under load.
 | 
			
		||||
   * <p>
 | 
			
		||||
   * A demo exposing the race condition is available at
 | 
			
		||||
   * <a href="https://gerrit-review.googlesource.com/#/c/68719/1">https://gerrit-review.googlesource.com/#/c/68719/1</a>.
 | 
			
		||||
   */
 | 
			
		||||
  @Test
 | 
			
		||||
  public void newPatchSetsNotifyConfig() throws Exception {
 | 
			
		||||
    Address addr = new Address("Watcher", "watcher@example.com");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user