apache / helix

Mirror of Apache Helix
Apache License 2.0
461 stars 224 forks source link

Fix flaky test TestDisableCustomCodeRunner.test #1299

Closed kaisun2000 closed 3 years ago

kaisun2000 commented 4 years ago

LOG: (368)

2020-08-21T06:26:35.4952198Z [ERROR] test(org.apache.helix.integration.TestDisableCustomCodeRunner) Time elapsed: 1.565 s <<< FAILURE! 2020-08-21T06:26:35.4957513Z java.lang.AssertionError: expected:< false > but was:< true > 2020-08-21T06:26:35.4967225Z at org.apache.helix.integration.TestDisableCustomCodeRunner.test(TestDisableCustomCodeRunner.java:233)

kaisun2000 commented 4 years ago

Need investigate more.

kaisun2000 commented 3 years ago
  // Re-enable custom-code runner
    admin.enableResource(clusterName, customCodeRunnerResource, true);
    ClusterStateVerifier.BestPossAndExtViewZkVerifier
        verifier = new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR, clusterName);
    try {
      result = ClusterStateVerifier.verifyByPolling(verifier, TestHelper.WAIT_DURATION);
      Assert.assertTrue(result);
    } finally {
      verifier.close();
    }

This seems a typical case without waiting before verifyByPolling, the verification can be too early.

kaisun2000 commented 3 years ago

second issue:

2020-09-17T03:50:18.5157922Z [ERROR] test(org.apache.helix.integration.TestDisableCustomCodeRunner) Time elapsed: 3.475 s <<< FAILURE! 2020-09-17T03:50:18.5159810Z java.lang.AssertionError: expected: but was: 2020-09-17T03:50:18.5161652Z at org.apache.helix.integration.TestDisableCustomCodeRunner.test(TestDisableCustomCodeRunner.java:236) 2020-09-17T03:50:18.5163211Z 2020

code:

  for (String instance : callbacks.keySet()) {
      DummyCallback callback = callbacks.get(instance);
      if (instance.equals(leader)) {
        Assert.assertTrue(callback.isInitTypeInvoked());
      } else {
        Assert.assertFalse(callback.isInitTypeInvoked());  --> 
      }
      callback.reset();

The question boils down why the assertion should be right? Let us disable it for now.