This is an automated email from the ASF dual-hosted git repository. nealsun pushed a commit to branch zookeeper-api-ttlcontainer in repository https://gitbox.apache.org/repos/asf/helix.git
commit 66c354a1af54a58710436cf82bcac9e4d4483948 Author: Ramin Bashizade <[email protected]> AuthorDate: Wed Jun 1 14:34:37 2022 -0700 Fix failing ZkClient TTL test (#2120) Some tests for the TTL feature rely on zookeeper.extendedTypesEnabled system property to be set. However, interleaving of test methods from different classes resulted in the property being cleaned by one completed test class while another class has tests that rely on this property still running. This commit sets the property at the beginning of every method that needs it, and cleans at the end of the method. --- .../zookeeper/impl/client/RealmAwareZkClientFactoryTestBase.java | 4 ++++ .../org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/RealmAwareZkClientFactoryTestBase.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/RealmAwareZkClientFactoryTestBase.java index a374b1f0e..cb27e16b1 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/RealmAwareZkClientFactoryTestBase.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/RealmAwareZkClientFactoryTestBase.java @@ -134,6 +134,7 @@ public abstract class RealmAwareZkClientFactoryTestBase extends RealmAwareZkClie // Clean up _realmAwareZkClient.deleteRecursively(TEST_VALID_PATH); + System.clearProperty("zookeeper.extendedTypesEnabled"); } /** @@ -141,6 +142,7 @@ public abstract class RealmAwareZkClientFactoryTestBase extends RealmAwareZkClie */ @Test(dependsOnMethods = "testRealmAwareZkClientCreateContainer") public void testRealmAwareZkClientCreateSequentialWithTTL() { + System.setProperty("zookeeper.extendedTypesEnabled", "true"); // Test writing and reading data _realmAwareZkClient.createPersistent(TEST_VALID_PATH, true); long ttl = 1L; @@ -152,6 +154,7 @@ public abstract class RealmAwareZkClientFactoryTestBase extends RealmAwareZkClie // Clean up _realmAwareZkClient.deleteRecursively(TEST_VALID_PATH); + System.clearProperty("zookeeper.extendedTypesEnabled"); } /** @@ -159,6 +162,7 @@ public abstract class RealmAwareZkClientFactoryTestBase extends RealmAwareZkClie */ @Test(dependsOnMethods = "testRealmAwareZkClientCreateSequentialWithTTL") public void testRealmAwareZkClientCreateWithTTL() { + System.setProperty("zookeeper.extendedTypesEnabled", "true"); // Test with createParents = true long ttl = 1L; _realmAwareZkClient.createPersistentWithTTL(TEST_VALID_PATH, true, ttl); diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java index f73624c2a..70581ca8f 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java @@ -192,6 +192,7 @@ public class TestFederatedZkClient extends RealmAwareZkClientTestBase { // Clean up _realmAwareZkClient.deleteRecursively(TEST_VALID_PATH); + System.clearProperty("zookeeper.extendedTypesEnabled"); } /** @@ -199,6 +200,7 @@ public class TestFederatedZkClient extends RealmAwareZkClientTestBase { */ @Test(dependsOnMethods = "testRealmAwareZkClientCreateContainer") public void testRealmAwareZkClientCreateSequentialWithTTL() { + System.setProperty("zookeeper.extendedTypesEnabled", "true"); // Create a dummy ZNRecord ZNRecord znRecord = new ZNRecord("DummyRecord"); znRecord.setSimpleField("Dummy", "Value"); @@ -214,6 +216,7 @@ public class TestFederatedZkClient extends RealmAwareZkClientTestBase { // Clean up _realmAwareZkClient.deleteRecursively(TEST_VALID_PATH); + System.clearProperty("zookeeper.extendedTypesEnabled"); } /** @@ -221,6 +224,7 @@ public class TestFederatedZkClient extends RealmAwareZkClientTestBase { */ @Test(dependsOnMethods = "testRealmAwareZkClientCreateSequentialWithTTL") public void testRealmAwareZkClientCreateWithTTL() { + System.setProperty("zookeeper.extendedTypesEnabled", "true"); // Create a dummy ZNRecord ZNRecord znRecord = new ZNRecord("DummyRecord"); znRecord.setSimpleField("Dummy", "Value");
