[GitHub] [hudi] trushev commented on a diff in pull request #7151: [MINOR] Performance improvement of flink ITs with reused miniCluster
trushev commented on code in PR #7151: URL: https://github.com/apache/hudi/pull/7151#discussion_r1018601277 ## hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/AbstractHoodieTestBase.java: ## @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.utils; + +import org.apache.hudi.exception.HoodieException; + +import org.apache.flink.test.util.AbstractTestBase; +import org.apache.flink.test.util.MiniClusterWithClientResource; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; + +import java.lang.reflect.Field; +import java.util.Arrays; + +import static java.lang.reflect.Modifier.isPublic; +import static java.lang.reflect.Modifier.isStatic; + +/** + * Hoodie base class for tests that run multiple tests and want to reuse the same Flink cluster. + * Unlike {@link AbstractTestBase}, this class is designed to run with JUnit 5. + */ +public abstract class AbstractHoodieTestBase extends AbstractTestBase { + + private static final MiniClusterWithClientResource MINI_CLUSTER_RESOURCE = getMiniClusterFromParentClass(); + + @BeforeAll Review Comment: implemented as junit5 extension -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [hudi] trushev commented on a diff in pull request #7151: [MINOR] Performance improvement of flink ITs with reused miniCluster
trushev commented on code in PR #7151: URL: https://github.com/apache/hudi/pull/7151#discussion_r1016315177 ## hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/AbstractHoodieTestBase.java: ## @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.utils; + +import org.apache.hudi.exception.HoodieException; + +import org.apache.flink.test.util.AbstractTestBase; +import org.apache.flink.test.util.MiniClusterWithClientResource; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; + +import java.lang.reflect.Field; +import java.util.Arrays; + +import static java.lang.reflect.Modifier.isPublic; +import static java.lang.reflect.Modifier.isStatic; + +/** + * Hoodie base class for tests that run multiple tests and want to reuse the same Flink cluster. + * Unlike {@link AbstractTestBase}, this class is designed to run with JUnit 5. + */ +public abstract class AbstractHoodieTestBase extends AbstractTestBase { + + private static final MiniClusterWithClientResource MINI_CLUSTER_RESOURCE = getMiniClusterFromParentClass(); + + @BeforeAll Review Comment: You are right, there is annotation `@EnableRuleMigrationSupport` from ```xml org.junit.jupiter junit-jupiter-migrationsupport ${junit.jupiter.version} test ``` and it works for `@Rule` ```java @EnableRuleMigrationSupport class MyRuleTest { @org.junit.Rule public ExternalResource myRule = new ExternalResource() { public void before() { System.out.println("before"); } }; @org.junit.jupiter.api.Test public void test() { System.out.println("test"); } } ``` ``` $ mvn test -Dtest=MyRuleTest before test ``` but for some reason it does not work for `@ClassRule` (our case) ```java @EnableRuleMigrationSupport class MyClassRuleTest { @org.junit.ClassRule public static ExternalResource myRule = new ExternalResource() { public void before() { System.out.println("before"); } }; @org.junit.jupiter.api.Test public void test() { System.out.println("test"); } } ``` ``` $ mvn test -Dtest=MyClassRuleTest test ``` There is only `@Rule` mentioned in official [doc](https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4-rule-support) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [hudi] trushev commented on a diff in pull request #7151: [MINOR] Performance improvement of flink ITs with reused miniCluster
trushev commented on code in PR #7151: URL: https://github.com/apache/hudi/pull/7151#discussion_r1016315177 ## hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/AbstractHoodieTestBase.java: ## @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.utils; + +import org.apache.hudi.exception.HoodieException; + +import org.apache.flink.test.util.AbstractTestBase; +import org.apache.flink.test.util.MiniClusterWithClientResource; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; + +import java.lang.reflect.Field; +import java.util.Arrays; + +import static java.lang.reflect.Modifier.isPublic; +import static java.lang.reflect.Modifier.isStatic; + +/** + * Hoodie base class for tests that run multiple tests and want to reuse the same Flink cluster. + * Unlike {@link AbstractTestBase}, this class is designed to run with JUnit 5. + */ +public abstract class AbstractHoodieTestBase extends AbstractTestBase { + + private static final MiniClusterWithClientResource MINI_CLUSTER_RESOURCE = getMiniClusterFromParentClass(); + + @BeforeAll Review Comment: You are right, there is annotation `@EnableRuleMigrationSupport` from ```xml org.junit.jupiter junit-jupiter-migrationsupport ${junit.jupiter.version} test ``` and it works for `@Rule` ```java @EnableRuleMigrationSupport class MyRuleTest { @org.junit.Rule public ExternalResource myRule = new ExternalResource() { public void before() { System.out.println("before"); } }; @org.junit.jupiter.api.Test public void test() { System.out.println("test"); } } ``` ``` $ mvn test -Dtest=MyRuleTest before test ``` but for some reason it does not work for `@ClassRule` (our case) ```java @EnableRuleMigrationSupport class MyClassRuleTest { @org.junit.ClassRule public static ExternalResource myRule = new ExternalResource() { public void before() { System.out.println("before"); } }; @org.junit.jupiter.api.Test public void test() { System.out.println("test"); } } ``` ``` $ mvn test -Dtest=MyClassRuleTest test ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [hudi] trushev commented on a diff in pull request #7151: [MINOR] Performance improvement of flink ITs with reused miniCluster
trushev commented on code in PR #7151: URL: https://github.com/apache/hudi/pull/7151#discussion_r1016121267 ## hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/AbstractHoodieTestBase.java: ## @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.utils; + +import org.apache.hudi.exception.HoodieException; + +import org.apache.flink.test.util.AbstractTestBase; +import org.apache.flink.test.util.MiniClusterWithClientResource; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; + +import java.lang.reflect.Field; +import java.util.Arrays; + +import static java.lang.reflect.Modifier.isPublic; +import static java.lang.reflect.Modifier.isStatic; + +/** + * Hoodie base class for tests that run multiple tests and want to reuse the same Flink cluster. + * Unlike {@link AbstractTestBase}, this class is designed to run with JUnit 5. + */ +public abstract class AbstractHoodieTestBase extends AbstractTestBase { + + private static final MiniClusterWithClientResource MINI_CLUSTER_RESOURCE = getMiniClusterFromParentClass(); + + @BeforeAll Review Comment: Essentially, we want to run junit 5 `org.junit.jupiter.api.Test` tests in class inherited from class contained junit 4 `org.junit.ClassRule`. Pseudocode: ```java class HoodieITCase extends FlinkBaseTest { run classRule.before() // junit4 run @Test test1() // junit5 run @Test test2() // junit5 run classRule.after() // junit4 } ``` I didn't find solution better than inroduced by this PR. Do you know mvn plugin that runs such tests? ## hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/AbstractHoodieTestBase.java: ## @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.utils; + +import org.apache.hudi.exception.HoodieException; + +import org.apache.flink.test.util.AbstractTestBase; +import org.apache.flink.test.util.MiniClusterWithClientResource; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; + +import java.lang.reflect.Field; +import java.util.Arrays; + +import static java.lang.reflect.Modifier.isPublic; +import static java.lang.reflect.Modifier.isStatic; + +/** + * Hoodie base class for tests that run multiple tests and want to reuse the same Flink cluster. + * Unlike {@link AbstractTestBase}, this class is designed to run with JUnit 5. + */ +public abstract class AbstractHoodieTestBase extends AbstractTestBase { + + private static final MiniClusterWithClientResource MINI_CLUSTER_RESOURCE = getMiniClusterFromParentClass(); + + @BeforeAll Review Comment: Essentially, we want to run junit5 `org.junit.jupiter.api.Test` tests in class inherited from class contained junit4 `org.junit.ClassRule`. Pseudocode: ```java class HoodieITCase extends FlinkBaseTest { run classRule.before() // junit4 run @Test test1() // junit5 run @Test test2() // junit5 run classRule.after() // junit4 } ``` I didn't find solution better than inroduced by this PR. Do you know mvn plugin that runs such tests? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to t
[GitHub] [hudi] trushev commented on a diff in pull request #7151: [MINOR] Performance improvement of flink ITs with reused miniCluster
trushev commented on code in PR #7151: URL: https://github.com/apache/hudi/pull/7151#discussion_r1016121267 ## hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/AbstractHoodieTestBase.java: ## @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.utils; + +import org.apache.hudi.exception.HoodieException; + +import org.apache.flink.test.util.AbstractTestBase; +import org.apache.flink.test.util.MiniClusterWithClientResource; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; + +import java.lang.reflect.Field; +import java.util.Arrays; + +import static java.lang.reflect.Modifier.isPublic; +import static java.lang.reflect.Modifier.isStatic; + +/** + * Hoodie base class for tests that run multiple tests and want to reuse the same Flink cluster. + * Unlike {@link AbstractTestBase}, this class is designed to run with JUnit 5. + */ +public abstract class AbstractHoodieTestBase extends AbstractTestBase { + + private static final MiniClusterWithClientResource MINI_CLUSTER_RESOURCE = getMiniClusterFromParentClass(); + + @BeforeAll Review Comment: Essentially, we want to run junit 5 `org.junit.jupiter.api.Test` tests in class inherited from junit 4 class contained `org.junit.ClassRule`. Pseudocode: ```java class HoodieITCase extends FlinkBaseTest { run classRule.before() // junit4 run @Test test1() // junit5 run @Test test2() // junit5 run classRule.after() // junit4 } ``` I didn't find solution better than inroduced by this PR. Do you know mvn plugin that runs such tests? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [hudi] trushev commented on a diff in pull request #7151: [MINOR] Performance improvement of flink ITs with reused miniCluster
trushev commented on code in PR #7151: URL: https://github.com/apache/hudi/pull/7151#discussion_r1014970150 ## hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/AbstractHoodieTestBase.java: ## @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.utils; + +import org.apache.hudi.exception.HoodieException; + +import org.apache.flink.test.util.AbstractTestBase; +import org.apache.flink.test.util.MiniClusterWithClientResource; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; + +import java.lang.reflect.Field; +import java.util.Arrays; + +import static java.lang.reflect.Modifier.isPublic; +import static java.lang.reflect.Modifier.isStatic; + +/** + * Hoodie base class for tests that run multiple tests and want to reuse the same Flink cluster. + * Unlike {@link AbstractTestBase}, this class is designed to run with JUnit 5. + */ +public abstract class AbstractHoodieTestBase extends AbstractTestBase { + + private static final MiniClusterWithClientResource MINI_CLUSTER_RESOURCE = getMiniClusterFromParentClass(); + + @BeforeAll Review Comment: Yes, `ClassRule` does not work We should call `MINI_CLUSTER_RESOURCE.before()` and `MINI_CLUSTER_RESOURCE.after()` using JUnit 5 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org