This is an automated email from the ASF dual-hosted git repository. echauchot pushed a commit to branch ci_utils in repository https://gitbox.apache.org/repos/asf/flink-connector-shared-utils.git
commit 2868ea13a2a287f11b65417ec308382d974faa81 Author: Etienne Chauchot <echauc...@apache.org> AuthorDate: Mon Nov 13 16:41:15 2023 +0100 [FLINK-34137] Create a parent and 2 sub modules: one with tests, and one with no tests --- .gitignore | 4 +++- archunit-violations/stored.rules | 10 ---------- .gitignore => module-with-no-tests/.gitignore | 5 ----- module-with-no-tests/pom.xml | 13 +++++++++++++ .../org/apache/flink/connector/testing/SomeClass2.java | 8 +++----- .gitignore => module-with-tests/.gitignore | 5 ----- .../1758f718-5b06-442d-8b5a-ad347bbf549e | 0 .../25d7c950-4d90-4419-b9af-78a9001796ce | 0 .../2c5e2ae5-0e19-423f-9501-d00b090b9d0e | 0 .../3e3429f1-b715-4057-91ce-f859c4c07245 | 0 .../662c8ab6-14a2-4f59-bacf-3e7a09427662 | 0 .../a2f52e44-eb11-4165-8a96-418e754ac1c6 | 0 .../b5a693ee-ab65-41b7-9764-cbe027c4ee12 | 0 .../f3351a4e-bc84-4164-aba1-3d729855e431 | 0 module-with-tests/archunit-violations/stored.rules | 10 ++++++++++ module-with-tests/pom.xml | 14 ++++++++++++++ .../java/org/apache/flink/connector/testing/SomeClass.java | 9 +-------- .../org/apache/flink/connector/testing/SomeClassTest.java | 0 .../architecture/ProductionCodeArchitectureTest.java | 0 .../testing/architecture/TestCodeArchitectureTest.java | 7 +------ .../src}/test/resources/archunit.properties | 0 pom.xml | 8 ++++++-- 22 files changed, 51 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index d6073bc..4e77b1e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ scalastyle-output.xml .idea !.idea/vcs.xml .metadata +module-with-no-tests/.metadata +module-with-tests/.metadata .settings .project .version.properties @@ -35,4 +37,4 @@ out/ tools/flink tools/flink-* tools/releasing/release -tools/japicmp-output \ No newline at end of file +tools/japicmp-output diff --git a/archunit-violations/stored.rules b/archunit-violations/stored.rules deleted file mode 100644 index 4c2eeb9..0000000 --- a/archunit-violations/stored.rules +++ /dev/null @@ -1,10 +0,0 @@ -# -#Wed Oct 11 15:35:58 CEST 2023 -Return\ and\ argument\ types\ of\ methods\ annotated\ with\ @Public\ must\ be\ annotated\ with\ @Public.=2b408df1-117c-43ee-8829-11a33f2f4c3d -Connector\ production\ code\ must\ not\ depend\ on\ non-public\ API\ outside\ of\ connector\ packages=47150079-df0b-4320-b1a9-117804d1d2b9 -ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=acfbc678-b208-4e82-b2c9-09b53dc0eec5 -Production\ code\ must\ not\ call\ methods\ annotated\ with\ @VisibleForTesting=a6ff808a-1aeb-4ff3-8fe6-3a5cb49fba71 -Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=06adde03-b226-46a1-880e-e3f9d0fbcfcb -Options\ for\ connectors\ and\ formats\ should\ reside\ in\ a\ consistent\ package\ and\ be\ public\ API.=737d7692-7d8e-4a4e-94d4-61e573619ec4 -Return\ and\ argument\ types\ of\ methods\ annotated\ with\ @PublicEvolving\ must\ be\ annotated\ with\ @Public(Evolving).=61e2247d-4ef0-4327-ad7f-2dc5cd881a4d -Classes\ in\ API\ packages\ should\ have\ at\ least\ one\ API\ visibility\ annotation.=9193bee2-f400-432f-b664-7ed218451dc9 diff --git a/.gitignore b/module-with-no-tests/.gitignore similarity index 82% copy from .gitignore copy to module-with-no-tests/.gitignore index d6073bc..78fd2bd 100644 --- a/.gitignore +++ b/module-with-no-tests/.gitignore @@ -4,7 +4,6 @@ scalastyle-output.xml .classpath .idea !.idea/vcs.xml -.metadata .settings .project .version.properties @@ -32,7 +31,3 @@ out/ /docs/.jekyll-metadata *.ipr *.iws -tools/flink -tools/flink-* -tools/releasing/release -tools/japicmp-output \ No newline at end of file diff --git a/module-with-no-tests/pom.xml b/module-with-no-tests/pom.xml new file mode 100644 index 0000000..da0c156 --- /dev/null +++ b/module-with-no-tests/pom.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.flink</groupId> + <artifactId>test-project-parent</artifactId> + <version>1.0</version> + </parent> + + <artifactId>module-with-no-tests</artifactId> +</project> diff --git a/src/test/java/org/apache/flink/connector/testing/SomeClassTest.java b/module-with-no-tests/src/main/java/org/apache/flink/connector/testing/SomeClass2.java similarity index 83% copy from src/test/java/org/apache/flink/connector/testing/SomeClassTest.java copy to module-with-no-tests/src/main/java/org/apache/flink/connector/testing/SomeClass2.java index 57630b7..8429c55 100644 --- a/src/test/java/org/apache/flink/connector/testing/SomeClassTest.java +++ b/module-with-no-tests/src/main/java/org/apache/flink/connector/testing/SomeClass2.java @@ -18,10 +18,8 @@ package org.apache.flink.connector.testing; -import org.junit.jupiter.api.Test; +/** A dummy class; only exists so that the compile/packaging plugins have something to do. */ +public class SomeClass2 { -class SomeClassTest { - - @Test - void someTest() {} + public static void main(String[] args) {} } diff --git a/.gitignore b/module-with-tests/.gitignore similarity index 82% copy from .gitignore copy to module-with-tests/.gitignore index d6073bc..78fd2bd 100644 --- a/.gitignore +++ b/module-with-tests/.gitignore @@ -4,7 +4,6 @@ scalastyle-output.xml .classpath .idea !.idea/vcs.xml -.metadata .settings .project .version.properties @@ -32,7 +31,3 @@ out/ /docs/.jekyll-metadata *.ipr *.iws -tools/flink -tools/flink-* -tools/releasing/release -tools/japicmp-output \ No newline at end of file diff --git a/archunit-violations/06adde03-b226-46a1-880e-e3f9d0fbcfcb b/module-with-tests/archunit-violations/1758f718-5b06-442d-8b5a-ad347bbf549e similarity index 100% rename from archunit-violations/06adde03-b226-46a1-880e-e3f9d0fbcfcb rename to module-with-tests/archunit-violations/1758f718-5b06-442d-8b5a-ad347bbf549e diff --git a/archunit-violations/2b408df1-117c-43ee-8829-11a33f2f4c3d b/module-with-tests/archunit-violations/25d7c950-4d90-4419-b9af-78a9001796ce similarity index 100% rename from archunit-violations/2b408df1-117c-43ee-8829-11a33f2f4c3d rename to module-with-tests/archunit-violations/25d7c950-4d90-4419-b9af-78a9001796ce diff --git a/archunit-violations/47150079-df0b-4320-b1a9-117804d1d2b9 b/module-with-tests/archunit-violations/2c5e2ae5-0e19-423f-9501-d00b090b9d0e similarity index 100% rename from archunit-violations/47150079-df0b-4320-b1a9-117804d1d2b9 rename to module-with-tests/archunit-violations/2c5e2ae5-0e19-423f-9501-d00b090b9d0e diff --git a/archunit-violations/61e2247d-4ef0-4327-ad7f-2dc5cd881a4d b/module-with-tests/archunit-violations/3e3429f1-b715-4057-91ce-f859c4c07245 similarity index 100% rename from archunit-violations/61e2247d-4ef0-4327-ad7f-2dc5cd881a4d rename to module-with-tests/archunit-violations/3e3429f1-b715-4057-91ce-f859c4c07245 diff --git a/archunit-violations/737d7692-7d8e-4a4e-94d4-61e573619ec4 b/module-with-tests/archunit-violations/662c8ab6-14a2-4f59-bacf-3e7a09427662 similarity index 100% rename from archunit-violations/737d7692-7d8e-4a4e-94d4-61e573619ec4 rename to module-with-tests/archunit-violations/662c8ab6-14a2-4f59-bacf-3e7a09427662 diff --git a/archunit-violations/9193bee2-f400-432f-b664-7ed218451dc9 b/module-with-tests/archunit-violations/a2f52e44-eb11-4165-8a96-418e754ac1c6 similarity index 100% rename from archunit-violations/9193bee2-f400-432f-b664-7ed218451dc9 rename to module-with-tests/archunit-violations/a2f52e44-eb11-4165-8a96-418e754ac1c6 diff --git a/archunit-violations/a6ff808a-1aeb-4ff3-8fe6-3a5cb49fba71 b/module-with-tests/archunit-violations/b5a693ee-ab65-41b7-9764-cbe027c4ee12 similarity index 100% rename from archunit-violations/a6ff808a-1aeb-4ff3-8fe6-3a5cb49fba71 rename to module-with-tests/archunit-violations/b5a693ee-ab65-41b7-9764-cbe027c4ee12 diff --git a/archunit-violations/acfbc678-b208-4e82-b2c9-09b53dc0eec5 b/module-with-tests/archunit-violations/f3351a4e-bc84-4164-aba1-3d729855e431 similarity index 100% rename from archunit-violations/acfbc678-b208-4e82-b2c9-09b53dc0eec5 rename to module-with-tests/archunit-violations/f3351a4e-bc84-4164-aba1-3d729855e431 diff --git a/module-with-tests/archunit-violations/stored.rules b/module-with-tests/archunit-violations/stored.rules new file mode 100644 index 0000000..e6fc6f1 --- /dev/null +++ b/module-with-tests/archunit-violations/stored.rules @@ -0,0 +1,10 @@ +# +#Mon Nov 13 16:33:48 CET 2023 +Return\ and\ argument\ types\ of\ methods\ annotated\ with\ @Public\ must\ be\ annotated\ with\ @Public.=662c8ab6-14a2-4f59-bacf-3e7a09427662 +Connector\ production\ code\ must\ not\ depend\ on\ non-public\ API\ outside\ of\ connector\ packages=3e3429f1-b715-4057-91ce-f859c4c07245 +ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=f3351a4e-bc84-4164-aba1-3d729855e431 +Production\ code\ must\ not\ call\ methods\ annotated\ with\ @VisibleForTesting=a2f52e44-eb11-4165-8a96-418e754ac1c6 +Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=b5a693ee-ab65-41b7-9764-cbe027c4ee12 +Options\ for\ connectors\ and\ formats\ should\ reside\ in\ a\ consistent\ package\ and\ be\ public\ API.=25d7c950-4d90-4419-b9af-78a9001796ce +Return\ and\ argument\ types\ of\ methods\ annotated\ with\ @PublicEvolving\ must\ be\ annotated\ with\ @Public(Evolving).=1758f718-5b06-442d-8b5a-ad347bbf549e +Classes\ in\ API\ packages\ should\ have\ at\ least\ one\ API\ visibility\ annotation.=2c5e2ae5-0e19-423f-9501-d00b090b9d0e diff --git a/module-with-tests/pom.xml b/module-with-tests/pom.xml new file mode 100644 index 0000000..c4e6084 --- /dev/null +++ b/module-with-tests/pom.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.flink</groupId> + <artifactId>test-project-parent</artifactId> + <version>1.0</version> + </parent> + + <artifactId>module-with-tests</artifactId> + +</project> diff --git a/src/main/java/org/apache/flink/connector/testing/SomeClass.java b/module-with-tests/src/main/java/org/apache/flink/connector/testing/SomeClass.java similarity index 73% rename from src/main/java/org/apache/flink/connector/testing/SomeClass.java rename to module-with-tests/src/main/java/org/apache/flink/connector/testing/SomeClass.java index 8285bb4..f29e5e0 100644 --- a/src/main/java/org/apache/flink/connector/testing/SomeClass.java +++ b/module-with-tests/src/main/java/org/apache/flink/connector/testing/SomeClass.java @@ -18,14 +18,7 @@ package org.apache.flink.connector.testing; -import static org.apache.flink.util.Preconditions.checkNotNull; - /** A dummy class; only exists so that the compile/packaging plugins have something to do. */ public class SomeClass { - public static void main(String[] args) { - // this call is an intended (for testing) violation of the - // ConnectorRules#CONNECTOR_CLASSES_ONLY_DEPEND_ON_PUBLIC_API archunit rule that was fixed - // in Flink 1.18 - checkNotNull(new Object()); - } + public static void main(String[] args) {} } diff --git a/src/test/java/org/apache/flink/connector/testing/SomeClassTest.java b/module-with-tests/src/test/java/org/apache/flink/connector/testing/SomeClassTest.java similarity index 100% rename from src/test/java/org/apache/flink/connector/testing/SomeClassTest.java rename to module-with-tests/src/test/java/org/apache/flink/connector/testing/SomeClassTest.java diff --git a/src/test/java/org/apache/flink/connector/testing/architecture/ProductionCodeArchitectureTest.java b/module-with-tests/src/test/java/org/apache/flink/connector/testing/architecture/ProductionCodeArchitectureTest.java similarity index 100% rename from src/test/java/org/apache/flink/connector/testing/architecture/ProductionCodeArchitectureTest.java rename to module-with-tests/src/test/java/org/apache/flink/connector/testing/architecture/ProductionCodeArchitectureTest.java diff --git a/src/test/java/org/apache/flink/connector/testing/architecture/TestCodeArchitectureTest.java b/module-with-tests/src/test/java/org/apache/flink/connector/testing/architecture/TestCodeArchitectureTest.java similarity index 86% rename from src/test/java/org/apache/flink/connector/testing/architecture/TestCodeArchitectureTest.java rename to module-with-tests/src/test/java/org/apache/flink/connector/testing/architecture/TestCodeArchitectureTest.java index 7357fcc..5d8e4ed 100644 --- a/src/test/java/org/apache/flink/connector/testing/architecture/TestCodeArchitectureTest.java +++ b/module-with-tests/src/test/java/org/apache/flink/connector/testing/architecture/TestCodeArchitectureTest.java @@ -28,12 +28,7 @@ import com.tngtech.archunit.junit.ArchTests; /** Architecture tests for test code. */ @AnalyzeClasses( - packages = { - "org.apache.flink.batch.connectors.cassandra", - "org.apache.flink.streaming.connectors.cassandra", - "org.apache.flink.connector.cassandra", - "org.apache.flink.connectors.cassandra" - }, + packages = {"org.apache.flink.connector.testing"}, importOptions = { ImportOption.OnlyIncludeTests.class, ImportOptions.ExcludeScalaImportOption.class, diff --git a/src/test/resources/archunit.properties b/module-with-tests/src/test/resources/archunit.properties similarity index 100% rename from src/test/resources/archunit.properties rename to module-with-tests/src/test/resources/archunit.properties diff --git a/pom.xml b/pom.xml index a32ad20..6fbeb01 100644 --- a/pom.xml +++ b/pom.xml @@ -24,13 +24,17 @@ under the License. <artifactId>flink-connector-parent</artifactId> <version>1.0.0</version> </parent> + <modules> + <module>module-with-no-tests</module> + <module>module-with-tests</module> + </modules> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.flink</groupId> - <artifactId>test-project</artifactId> + <artifactId>test-project-parent</artifactId> <version>1.0</version> - <packaging>jar</packaging> + <packaging>pom</packaging> <properties> <flink.version>1.17.1</flink.version>