This is an automated email from the ASF dual-hosted git repository.

jingge pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 05960a7ccf2 [FLINK-26013][flink-core][test] add archunit tests for the 
test code
05960a7ccf2 is described below

commit 05960a7ccf2a6900e87159a6925595b9df6289f2
Author: jingge <gej...@gmail.com>
AuthorDate: Sat Nov 25 08:39:05 2023 +0100

    [FLINK-26013][flink-core][test] add archunit tests for the test code
---
 .../0c7796e9-15d6-4c0d-9fe3-3846e1b5347c           | 12 ++++++
 .../b0ef1607-07ca-4378-b7d7-a2a15a8eaa9b           |  0
 flink-core/archunit-violations/stored.rules        |  4 ++
 flink-core/pom.xml                                 |  8 ++++
 .../architecture/TestCodeArchitectureTest.java     | 48 ++++++++++++++++++++++
 flink-core/src/test/resources/archunit.properties  | 31 ++++++++++++++
 6 files changed, 103 insertions(+)

diff --git 
a/flink-core/archunit-violations/0c7796e9-15d6-4c0d-9fe3-3846e1b5347c 
b/flink-core/archunit-violations/0c7796e9-15d6-4c0d-9fe3-3846e1b5347c
new file mode 100644
index 00000000000..dae1c5ba475
--- /dev/null
+++ b/flink-core/archunit-violations/0c7796e9-15d6-4c0d-9fe3-3846e1b5347c
@@ -0,0 +1,12 @@
+org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializerConcurrencyCheckInactiveITCase
 does not satisfy: only one of the following predicates match:\
+* reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
+* reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
+* reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
+* reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
+ or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
+org.apache.flink.types.RecordITCase does not satisfy: only one of the 
following predicates match:\
+* reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
+* reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
+* reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
+* reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
+ or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
\ No newline at end of file
diff --git 
a/flink-core/archunit-violations/b0ef1607-07ca-4378-b7d7-a2a15a8eaa9b 
b/flink-core/archunit-violations/b0ef1607-07ca-4378-b7d7-a2a15a8eaa9b
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/flink-core/archunit-violations/stored.rules 
b/flink-core/archunit-violations/stored.rules
new file mode 100644
index 00000000000..c8a7fec514b
--- /dev/null
+++ b/flink-core/archunit-violations/stored.rules
@@ -0,0 +1,4 @@
+#
+#Sat Nov 25 08:21:50 CET 2023
+ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ 
extension=0c7796e9-15d6-4c0d-9fe3-3846e1b5347c
+Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ 
ITCase=b0ef1607-07ca-4378-b7d7-a2a15a8eaa9b
diff --git a/flink-core/pom.xml b/flink-core/pom.xml
index aee94432815..19c3e94db41 100644
--- a/flink-core/pom.xml
+++ b/flink-core/pom.xml
@@ -71,6 +71,14 @@ under the License.
                        <version>${project.version}</version>
                </dependency>
 
+               <!-- ArchUit test dependencies -->
+
+               <dependency>
+                       <groupId>org.apache.flink</groupId>
+                       <artifactId>flink-architecture-tests-test</artifactId>
+                       <scope>test</scope>
+               </dependency>
+
                <dependency>
                        <groupId>org.apache.flink</groupId>
                        <artifactId>flink-shaded-asm-9</artifactId>
diff --git 
a/flink-core/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
 
b/flink-core/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
new file mode 100644
index 00000000000..d5cd0493adc
--- /dev/null
+++ 
b/flink-core/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.architecture;
+
+import org.apache.flink.architecture.common.ImportOptions;
+
+import com.tngtech.archunit.core.importer.ImportOption;
+import com.tngtech.archunit.junit.AnalyzeClasses;
+import com.tngtech.archunit.junit.ArchTest;
+import com.tngtech.archunit.junit.ArchTests;
+
+/** Architecture tests for test code. */
+@AnalyzeClasses(
+        packages = {
+            "org.apache.flink.api",
+            "org.apache.flink.configuration",
+            "org.apache.flink.core",
+            "org.apache.flink.management.jmx",
+            "org.apache.flink.testutils",
+            "org.apache.flink.types",
+            "org.apache.flink.util",
+        },
+        importOptions = {
+            ImportOption.OnlyIncludeTests.class,
+            ImportOptions.ExcludeScalaImportOption.class,
+            ImportOptions.ExcludeShadedImportOption.class
+        })
+public class TestCodeArchitectureTest {
+
+    @ArchTest
+    public static final ArchTests COMMON_TESTS = 
ArchTests.in(TestCodeArchitectureTestBase.class);
+}
diff --git a/flink-core/src/test/resources/archunit.properties 
b/flink-core/src/test/resources/archunit.properties
new file mode 100644
index 00000000000..15be88c95ba
--- /dev/null
+++ b/flink-core/src/test/resources/archunit.properties
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+# By default we allow removing existing violations, but fail when new 
violations are added.
+freeze.store.default.allowStoreUpdate=true
+
+# Enable this if a new (frozen) rule has been added in order to create the 
initial store and record the existing violations.
+#freeze.store.default.allowStoreCreation=true
+
+# Enable this to add allow new violations to be recorded.
+# NOTE: Adding new violations should be avoided when possible. If the rule was 
correct to flag a new
+#       violation, please try to avoid creating the violation. If the 
violation was created due to a
+#       shortcoming of the rule, file a JIRA issue so the rule can be improved.
+#freeze.refreeze=true
+
+freeze.store.default.path=archunit-violations

Reply via email to