From 69b46da08ecb6659f9796165974d0dbe7871512e Mon Sep 17 00:00:00 2001 From: Lorenzo Nicora Date: Mon, 28 Oct 2024 11:55:31 +0000 Subject: [PATCH] Set up archunit tests and violations --- .../6e53c00e-cca1-4df3-a67b-55a742f82f49 | 0 .../b84f2d4b-67b7-44ff-9dc5-9a946a67c5e9 | 0 .../archunit-violations/stored.rules | 4 ++ .../pom.xml | 8 ++++ .../TestCodeArchitectureTest.java | 39 +++++++++++++++++++ .../src/test/resources/archunit.properties | 30 ++++++++++++++ .../75250488-2d5e-433d-8fc4-51ff28cb11b3 | 0 .../d962399a-ad51-48ff-ab30-23969cef546c | 0 .../archunit-violations/stored.rules | 4 ++ flink-connector-prometheus/pom.xml | 6 +++ .../TestCodeArchitectureTest.java | 39 +++++++++++++++++++ .../src/test/resources/archunit.properties | 30 ++++++++++++++ pom.xml | 8 ++++ 13 files changed, 168 insertions(+) create mode 100644 flink-connector-prometheus-request-signer-amp/archunit-violations/6e53c00e-cca1-4df3-a67b-55a742f82f49 create mode 100644 flink-connector-prometheus-request-signer-amp/archunit-violations/b84f2d4b-67b7-44ff-9dc5-9a946a67c5e9 create mode 100644 flink-connector-prometheus-request-signer-amp/archunit-violations/stored.rules create mode 100644 flink-connector-prometheus-request-signer-amp/src/test/java/architecture/TestCodeArchitectureTest.java create mode 100644 flink-connector-prometheus-request-signer-amp/src/test/resources/archunit.properties create mode 100644 flink-connector-prometheus/archunit-violations/75250488-2d5e-433d-8fc4-51ff28cb11b3 create mode 100644 flink-connector-prometheus/archunit-violations/d962399a-ad51-48ff-ab30-23969cef546c create mode 100644 flink-connector-prometheus/archunit-violations/stored.rules create mode 100644 flink-connector-prometheus/src/test/java/org/apache/architecture/TestCodeArchitectureTest.java create mode 100644 flink-connector-prometheus/src/test/resources/archunit.properties diff --git a/flink-connector-prometheus-request-signer-amp/archunit-violations/6e53c00e-cca1-4df3-a67b-55a742f82f49 b/flink-connector-prometheus-request-signer-amp/archunit-violations/6e53c00e-cca1-4df3-a67b-55a742f82f49 new file mode 100644 index 0000000..e69de29 diff --git a/flink-connector-prometheus-request-signer-amp/archunit-violations/b84f2d4b-67b7-44ff-9dc5-9a946a67c5e9 b/flink-connector-prometheus-request-signer-amp/archunit-violations/b84f2d4b-67b7-44ff-9dc5-9a946a67c5e9 new file mode 100644 index 0000000..e69de29 diff --git a/flink-connector-prometheus-request-signer-amp/archunit-violations/stored.rules b/flink-connector-prometheus-request-signer-amp/archunit-violations/stored.rules new file mode 100644 index 0000000..2290459 --- /dev/null +++ b/flink-connector-prometheus-request-signer-amp/archunit-violations/stored.rules @@ -0,0 +1,4 @@ +# +#Mon Oct 28 11:45:11 GMT 2024 +ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=6e53c00e-cca1-4df3-a67b-55a742f82f49 +Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=b84f2d4b-67b7-44ff-9dc5-9a946a67c5e9 diff --git a/flink-connector-prometheus-request-signer-amp/pom.xml b/flink-connector-prometheus-request-signer-amp/pom.xml index d7292b8..ae3dd0c 100644 --- a/flink-connector-prometheus-request-signer-amp/pom.xml +++ b/flink-connector-prometheus-request-signer-amp/pom.xml @@ -72,6 +72,14 @@ under the License. junit-jupiter test + + + + org.apache.flink + flink-architecture-tests-test + ${flink.version} + test + diff --git a/flink-connector-prometheus-request-signer-amp/src/test/java/architecture/TestCodeArchitectureTest.java b/flink-connector-prometheus-request-signer-amp/src/test/java/architecture/TestCodeArchitectureTest.java new file mode 100644 index 0000000..e393beb --- /dev/null +++ b/flink-connector-prometheus-request-signer-amp/src/test/java/architecture/TestCodeArchitectureTest.java @@ -0,0 +1,39 @@ +/* + * 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 architecture; + +import org.apache.flink.architecture.TestCodeArchitectureTestBase; +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.connector.prometheus", + 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-connector-prometheus-request-signer-amp/src/test/resources/archunit.properties b/flink-connector-prometheus-request-signer-amp/src/test/resources/archunit.properties new file mode 100644 index 0000000..86755b5 --- /dev/null +++ b/flink-connector-prometheus-request-signer-amp/src/test/resources/archunit.properties @@ -0,0 +1,30 @@ +# +# 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 \ No newline at end of file diff --git a/flink-connector-prometheus/archunit-violations/75250488-2d5e-433d-8fc4-51ff28cb11b3 b/flink-connector-prometheus/archunit-violations/75250488-2d5e-433d-8fc4-51ff28cb11b3 new file mode 100644 index 0000000..e69de29 diff --git a/flink-connector-prometheus/archunit-violations/d962399a-ad51-48ff-ab30-23969cef546c b/flink-connector-prometheus/archunit-violations/d962399a-ad51-48ff-ab30-23969cef546c new file mode 100644 index 0000000..e69de29 diff --git a/flink-connector-prometheus/archunit-violations/stored.rules b/flink-connector-prometheus/archunit-violations/stored.rules new file mode 100644 index 0000000..b26dd83 --- /dev/null +++ b/flink-connector-prometheus/archunit-violations/stored.rules @@ -0,0 +1,4 @@ +# +#Mon Oct 28 11:44:17 GMT 2024 +ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=d962399a-ad51-48ff-ab30-23969cef546c +Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=75250488-2d5e-433d-8fc4-51ff28cb11b3 diff --git a/flink-connector-prometheus/pom.xml b/flink-connector-prometheus/pom.xml index 84fa4ab..283f9d0 100644 --- a/flink-connector-prometheus/pom.xml +++ b/flink-connector-prometheus/pom.xml @@ -110,5 +110,11 @@ under the License. test + + + org.apache.flink + flink-architecture-tests-test + test + \ No newline at end of file diff --git a/flink-connector-prometheus/src/test/java/org/apache/architecture/TestCodeArchitectureTest.java b/flink-connector-prometheus/src/test/java/org/apache/architecture/TestCodeArchitectureTest.java new file mode 100644 index 0000000..d8bc099 --- /dev/null +++ b/flink-connector-prometheus/src/test/java/org/apache/architecture/TestCodeArchitectureTest.java @@ -0,0 +1,39 @@ +/* + * 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.architecture; + +import org.apache.flink.architecture.TestCodeArchitectureTestBase; +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.connector.prometheus", + 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-connector-prometheus/src/test/resources/archunit.properties b/flink-connector-prometheus/src/test/resources/archunit.properties new file mode 100644 index 0000000..86755b5 --- /dev/null +++ b/flink-connector-prometheus/src/test/resources/archunit.properties @@ -0,0 +1,30 @@ +# +# 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 \ No newline at end of file diff --git a/pom.xml b/pom.xml index cafcc44..2ac2174 100644 --- a/pom.xml +++ b/pom.xml @@ -148,6 +148,14 @@ under the License. import + + + org.apache.flink + flink-architecture-tests-test + ${flink.version} + test + +