You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ma...@apache.org on 2024/05/14 07:00:23 UTC
(flink-connector-kudu) 04/44: [BAHIR-179] Fail Docker integration tests silently
This is an automated email from the ASF dual-hosted git repository.
martijnvisser pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-connector-kudu.git
commit 701fabeeb897f13cfcde2e55c8a035c1589e74fc
Author: eskabetxe <bo...@boto.pro>
AuthorDate: Wed Jan 9 17:29:32 2019 +0100
[BAHIR-179] Fail Docker integration tests silently
When running docker based integration tests locally,
fail silentily if env requirements not available.
Closes #38
Closes #35
---
flink-connector-kudu/pom.xml | 42 ++++------------------
.../streaming/connectors/kudu/DockerTest.java | 31 ++++++++++++++++
.../connectors/kudu/KuduInputFormatTest.java | 4 +--
.../connectors/kudu/KuduOuputFormatTest.java | 3 +-
.../streaming/connectors/kudu/KuduSinkTest.java | 2 +-
.../src/test/resources/log4j.properties | 27 ++++++++++++++
6 files changed, 67 insertions(+), 42 deletions(-)
diff --git a/flink-connector-kudu/pom.xml b/flink-connector-kudu/pom.xml
index 348371b..61ab4a6 100644
--- a/flink-connector-kudu/pom.xml
+++ b/flink-connector-kudu/pom.xml
@@ -31,7 +31,8 @@
<properties>
<kudu.version>1.7.1</kudu.version>
- <junit.version>5.2.0</junit.version>
+
+ <junit.groups>!DockerTest</junit.groups>
</properties>
<dependencies>
@@ -58,45 +59,14 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
</dependencies>
<profiles>
<profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/*Test.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>test-kudu</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
+ <id>docker-test</id>
+ <properties>
+ <junit.groups>DockerTest</junit.groups>
+ </properties>
</profile>
</profiles>
diff --git a/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/DockerTest.java b/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/DockerTest.java
new file mode 100644
index 0000000..070e634
--- /dev/null
+++ b/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/DockerTest.java
@@ -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.
+ */
+package org.apache.flink.streaming.connectors.kudu;
+
+import org.junit.jupiter.api.Tag;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+@Tag("DockerTest")
+public @interface DockerTest {
+}
+
diff --git a/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduInputFormatTest.java b/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduInputFormatTest.java
index 8cfc102..eb9dc00 100644
--- a/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduInputFormatTest.java
+++ b/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduInputFormatTest.java
@@ -26,11 +26,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+@DockerTest
public class KuduInputFormatTest extends KuduDatabase {
-
-
-
@Test
public void testInvalidKuduMaster() throws IOException {
KuduTableInfo tableInfo = booksTableInfo("books",false);
diff --git a/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduOuputFormatTest.java b/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduOuputFormatTest.java
index 6eb5ebe..e282185 100644
--- a/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduOuputFormatTest.java
+++ b/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduOuputFormatTest.java
@@ -26,10 +26,9 @@ import java.io.IOException;
import java.util.List;
import java.util.UUID;
+@DockerTest
public class KuduOuputFormatTest extends KuduDatabase {
-
-
@Test
public void testInvalidKuduMaster() throws IOException {
KuduTableInfo tableInfo = booksTableInfo(UUID.randomUUID().toString(),false);
diff --git a/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduSinkTest.java b/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduSinkTest.java
index 9e9ae93..a89580f 100644
--- a/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduSinkTest.java
+++ b/flink-connector-kudu/src/test/java/org/apache/flink/streaming/connectors/kudu/KuduSinkTest.java
@@ -27,9 +27,9 @@ import java.io.IOException;
import java.util.List;
import java.util.UUID;
+@DockerTest
public class KuduSinkTest extends KuduDatabase {
-
@Test
public void testInvalidKuduMaster() throws IOException {
KuduTableInfo tableInfo = booksTableInfo(UUID.randomUUID().toString(),false);
diff --git a/flink-connector-kudu/src/test/resources/log4j.properties b/flink-connector-kudu/src/test/resources/log4j.properties
new file mode 100644
index 0000000..15efe08
--- /dev/null
+++ b/flink-connector-kudu/src/test/resources/log4j.properties
@@ -0,0 +1,27 @@
+################################################################################
+# 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.
+################################################################################
+
+# This file ensures that tests executed from the IDE show log output
+
+log4j.rootLogger=WARN, console
+
+# Log all infos in the given file
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.target=System.err
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n