From 0d7a07427d32949181614138b1950da864930f1a Mon Sep 17 00:00:00 2001 From: jingge Date: Sat, 25 Nov 2023 08:10:30 +0100 Subject: [PATCH] [FLINK-26010][s3-fs-presto][test] add ArchUnit tests for the test code --- flink-filesystems/flink-s3-fs-presto/pom.xml | 8 ++++ .../TestCodeArchitectureTest.java | 39 +++++++++++++++++++ .../src/test/resources/archunit.properties | 31 +++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 flink-filesystems/flink-s3-fs-presto/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java create mode 100644 flink-filesystems/flink-s3-fs-presto/src/test/resources/archunit.properties diff --git a/flink-filesystems/flink-s3-fs-presto/pom.xml b/flink-filesystems/flink-s3-fs-presto/pom.xml index d60fe53debf348..cc5b22ef603e9c 100644 --- a/flink-filesystems/flink-s3-fs-presto/pom.xml +++ b/flink-filesystems/flink-s3-fs-presto/pom.xml @@ -45,6 +45,14 @@ under the License. provided + + + + org.apache.flink + flink-architecture-tests-test + test + + org.apache.flink diff --git a/flink-filesystems/flink-s3-fs-presto/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java b/flink-filesystems/flink-s3-fs-presto/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java new file mode 100644 index 00000000000000..b0e064331baacf --- /dev/null +++ b/flink-filesystems/flink-s3-fs-presto/src/test/java/org/apache/flink/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.flink.architecture; + +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; +import org.apache.flink.architecture.common.ImportOptions; + +/** Architecture tests for test code. */ +@AnalyzeClasses( + packages = {"org.apache.flink.fs.s3presto"}, + 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-filesystems/flink-s3-fs-presto/src/test/resources/archunit.properties b/flink-filesystems/flink-s3-fs-presto/src/test/resources/archunit.properties new file mode 100644 index 00000000000000..15be88c95ba460 --- /dev/null +++ b/flink-filesystems/flink-s3-fs-presto/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