This is an automated email from the ASF dual-hosted git repository. martijnvisser pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit d7a6ed427da14031954a1f548e61d1255a2ce21f Author: Jing Ge <gej...@gmail.com> AuthorDate: Mon Apr 4 17:20:13 2022 +0200 [FLINK-26011][json-glue-schema-registry][test] add ArchUnit tests for the test code --- .../4703059b-4f06-41c9-9724-644e6d00584f | 0 .../b99819a4-a946-475e-883f-963de77c7e57 | 0 .../archunit-violations/stored.rules | 4 +++ .../flink-json-glue-schema-registry/pom.xml | 13 +++++++ .../architecture/TestCodeArchitectureTest.java | 40 ++++++++++++++++++++++ .../src/test/resources/archunit.properties | 31 +++++++++++++++++ 6 files changed, 88 insertions(+) diff --git a/flink-formats/flink-json-glue-schema-registry/archunit-violations/4703059b-4f06-41c9-9724-644e6d00584f b/flink-formats/flink-json-glue-schema-registry/archunit-violations/4703059b-4f06-41c9-9724-644e6d00584f new file mode 100644 index 00000000000..e69de29bb2d diff --git a/flink-formats/flink-json-glue-schema-registry/archunit-violations/b99819a4-a946-475e-883f-963de77c7e57 b/flink-formats/flink-json-glue-schema-registry/archunit-violations/b99819a4-a946-475e-883f-963de77c7e57 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/flink-formats/flink-json-glue-schema-registry/archunit-violations/stored.rules b/flink-formats/flink-json-glue-schema-registry/archunit-violations/stored.rules new file mode 100644 index 00000000000..463e6804b24 --- /dev/null +++ b/flink-formats/flink-json-glue-schema-registry/archunit-violations/stored.rules @@ -0,0 +1,4 @@ +# +#Mon Apr 04 17:19:25 CEST 2022 +Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=4703059b-4f06-41c9-9724-644e6d00584f +ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=b99819a4-a946-475e-883f-963de77c7e57 diff --git a/flink-formats/flink-json-glue-schema-registry/pom.xml b/flink-formats/flink-json-glue-schema-registry/pom.xml index e9ef549c727..3ae34918dfb 100644 --- a/flink-formats/flink-json-glue-schema-registry/pom.xml +++ b/flink-formats/flink-json-glue-schema-registry/pom.xml @@ -141,6 +141,19 @@ under the License. <version>1.12.2</version> </dependency> + <!-- ArchUit test dependencies --> + + <dependency> + <groupId>org.apache.flink</groupId> + <artifactId>flink-architecture-tests-test</artifactId> + <exclusions> + <exclusion> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </exclusion> + </exclusions> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/flink-formats/flink-json-glue-schema-registry/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java b/flink-formats/flink-json-glue-schema-registry/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java new file mode 100644 index 00000000000..0724f1582fa --- /dev/null +++ b/flink-formats/flink-json-glue-schema-registry/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java @@ -0,0 +1,40 @@ +/* + * 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.formats.json.glue.schema.registry"}, + 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-formats/flink-json-glue-schema-registry/src/test/resources/archunit.properties b/flink-formats/flink-json-glue-schema-registry/src/test/resources/archunit.properties new file mode 100644 index 00000000000..15be88c95ba --- /dev/null +++ b/flink-formats/flink-json-glue-schema-registry/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