You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/11/22 13:26:14 UTC
[GitHub] [iotdb] Cpaulyz opened a new pull request, #8097: [IOTDB-5021] Using Junit parameterized test to optimize schema IT framework
Cpaulyz opened a new pull request, #8097:
URL: https://github.com/apache/iotdb/pull/8097
## Description
In order to make the integrate tests cover Schema_File mode and Memory mode, we originally needed to create two classes for each IT, such as IoTDBMetadataFetchIT and IoTDBMetadataFetchSchemaFileIT, which would result in a large number of classes.
This ISSUE introduces a JUnit parametric test approach. An `AbstractSchemaIT` abstract class is created for all schema test, and its subclasses will automatically run tests in both schema engine modes.
> reference:
> https://blog.csdn.net/w605283073/article/details/80051229
> https://stackoverflow.com/questions/27745691/how-to-combine-runwith-with-runwithparameterized-class
<img width="663" alt="image" src="https://user-images.githubusercontent.com/43774645/203325179-c55b8e5e-8566-408b-ba63-801fba375d5e.png">
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] ericpai commented on a diff in pull request #8097: [IOTDB-5021] Using Junit parameterized test to optimize schema IT framework
Posted by GitBox <gi...@apache.org>.
ericpai commented on code in PR #8097:
URL: https://github.com/apache/iotdb/pull/8097#discussion_r1031007154
##########
integration-test/src/test/java/org/apache/iotdb/db/it/schema/AbstractSchemaIT.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.iotdb.db.it.schema;
+
+import org.apache.iotdb.it.env.ConfigFactory;
+import org.apache.iotdb.it.framework.IoTDBTestRunnerWithParametersFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+
+/**
+ * This class define multiple modes for schema engine. All IT class extends AbstractSchemaIT will be
+ * run in both Memory and Schema_File modes. In Schema_File mode, there are three kinds of test
+ * environment: full memory, partial memory and non memory.
+ *
+ * <p>Notice that, all IT class extends AbstractSchemaIT need to call {@link AbstractSchemaIT#setUp}
+ * before test env initialization and call {@link AbstractSchemaIT#tearDown} after test env
+ * cleaning. initialize
+ */
+@RunWith(Parameterized.class)
+@Parameterized.UseParametersRunnerFactory(IoTDBTestRunnerWithParametersFactory.class)
+public abstract class AbstractSchemaIT {
+
+ protected SchemaTestMode schemaTestMode;
+ private String defaultSchemaEngineMode;
+ private int defaultCachedMNodeSizeInSchemaFileMode;
+
+ @Parameterized.Parameters(name = "SchemaEngineMode={0}")
+ public static Iterable<SchemaTestMode> data() {
+ return Arrays.asList(
+ SchemaTestMode.Memory,
+ SchemaTestMode.SchemaFileFullMemory,
+ SchemaTestMode.SchemaFilePartialMemory,
+ SchemaTestMode.SchemaFileNonMemory);
+ }
+
+ public AbstractSchemaIT(SchemaTestMode schemaTestMode) {
+ this.schemaTestMode = schemaTestMode;
+ }
+
+ @Before
Review Comment:
My guess about the unexpected test failures due to 'cluster can't work' is that we declare `@Before` and `@After` in both super class and child class. Just use them in child one.
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] MarcosZyk merged pull request #8097: [IOTDB-5021] Using Junit parameterized test to optimize schema IT framework
Posted by "MarcosZyk (via GitHub)" <gi...@apache.org>.
MarcosZyk merged PR #8097:
URL: https://github.com/apache/iotdb/pull/8097
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Cpaulyz commented on a diff in pull request #8097: [IOTDB-5021] Using Junit parameterized test to optimize schema IT framework
Posted by GitBox <gi...@apache.org>.
Cpaulyz commented on code in PR #8097:
URL: https://github.com/apache/iotdb/pull/8097#discussion_r1032063412
##########
integration-test/src/main/java/org/apache/iotdb/it/framework/IoTDBTestRunnerWithParameters.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.iotdb.it.framework;
+
+import org.apache.iotdb.it.env.EnvFactory;
+
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters;
+import org.junit.runners.parameterized.TestWithParameters;
+import org.slf4j.Logger;
+
+public class IoTDBTestRunnerWithParameters extends BlockJUnit4ClassRunnerWithParameters {
Review Comment:
It seems difficult to implement because Parameize requires the runner to be a subclass of `BlockJUnit4ClassRunnerWithParameters`, but `IoTDBRunner` is a subclass of `BlockJUnit4ClassRunner`.
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] ericpai commented on a diff in pull request #8097: [IOTDB-5021] Using Junit parameterized test to optimize schema IT framework
Posted by GitBox <gi...@apache.org>.
ericpai commented on code in PR #8097:
URL: https://github.com/apache/iotdb/pull/8097#discussion_r1030981270
##########
integration-test/src/main/java/org/apache/iotdb/it/framework/IoTDBTestRunnerWithParameters.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.iotdb.it.framework;
+
+import org.apache.iotdb.it.env.EnvFactory;
+
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters;
+import org.junit.runners.parameterized.TestWithParameters;
+import org.slf4j.Logger;
+
+public class IoTDBTestRunnerWithParameters extends BlockJUnit4ClassRunnerWithParameters {
Review Comment:
Can this runner be merged to `IoTDBTestRunner` to simplify the framework usage, which means that
`IoTDBTestRunner` can be used with an optional parameter.
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org