JingGe commented on a change in pull request #18847:
URL: https://github.com/apache/flink/pull/18847#discussion_r812697785
##########
File path:
flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/rules/ITCaseRules.java
##########
@@ -61,18 +66,21 @@
* <p>1. For JUnit 5 test, both fields are required like:
*
* <pre>{@code
+ * @RegisterExtension
* public static final MiniClusterExtension MINI_CLUSTER_RESOURCE =
* new MiniClusterExtension(
* new MiniClusterResourceConfiguration.Builder()
* .setConfiguration(getFlinkConfiguration())
* .build());
+ * }</pre>
*
- * @RegisterExtension
- * public static AllCallbackWrapper allCallbackWrapper =
- * new AllCallbackWrapper(MINI_CLUSTER_RESOURCE);
+ * <p>2. For JUnit 5 test, use {@link ExtendWith}:
+ *
+ * <pre>{@code
+ * @ExtendWith(MiniClusterExtension.class)
Review comment:
Where to use it? at class level?
##########
File path: flink-architecture-tests/flink-architecture-tests-test/README.md
##########
@@ -55,3 +55,12 @@ Please refer to [README](../README.md).
## How do I test Scala classes?
Please refer to [README](../README.md).
+
+## What should I do if I modify an existing rule?
+
+In that case, you need to regenerate all the stores. Just run this on the root
of the project:
+
+```
+rm -rf `find . -type d -name archunit-violations`
+mvn test -Dtest="*TestCodeArchitectureTest*" -DfailIfNoTests=false
-Darchunit.freeze.refreeze=true
-Darchunit.freeze.store.default.allowStoreCreation=true -Dfast
Review comment:
NIT: -Dskip.npm=true
##########
File path:
flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/rules/ITCaseRules.java
##########
@@ -135,14 +140,46 @@
MiniClusterWithClientResource.class, Rule.class));
}
+ private static DescribedPredicate<JavaClass> inFlinkRuntimePackages() {
+ return
JavaClass.Predicates.resideInAPackage("org.apache.flink.runtime.*");
Review comment:
import static?
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/testutils/InternalMiniClusterExtension.java
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.flink.runtime.testutils;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.configuration.UnmodifiableConfiguration;
+import org.apache.flink.runtime.minicluster.MiniCluster;
+import org.apache.flink.test.junit5.InjectClusterClientConfiguration;
+import org.apache.flink.test.junit5.InjectClusterRESTAddress;
+import org.apache.flink.test.junit5.InjectMiniCluster;
+
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.ParameterContext;
+import org.junit.jupiter.api.extension.ParameterResolutionException;
+import org.junit.jupiter.api.extension.ParameterResolver;
+
+import java.net.URI;
+
+/**
+ * An extension which starts a {@link MiniCluster} for testing purposes.
+ *
+ * <p>This should only be used by tests within the flink-runtime module. Other
modules should use
Review comment:
Could you add more description to tell why a different
MiniClusterExtension is required explicitly for flink-runtime and the same
MiniClusterExtension can not be used by other modules? I think the idea of
using @InjectMiniCluster is excellent and could be very useful for tests in
other modules beyond flink-runtime too.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]