You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fp...@apache.org on 2021/12/02 07:42:59 UTC

[flink] branch release-1.14 updated (d52874a -> 0d9aed95)

This is an automated email from the ASF dual-hosted git repository.

fpaul pushed a change to branch release-1.14
in repository https://gitbox.apache.org/repos/asf/flink.git.


    from d52874a  [FLINK-24348][FLINK-24740][testinfrastructure][kafka] Update testcontainers dependency to v1.16.2
     new 42e0e58  [FLINK-15493][test] Inherit retry rule annotations to sub classes
     new a67afb2  [FLINK-15493][test] Add retry rule for all tests based on KafkaTestBase
     new 0d9aed95 [FLINK-25134][test] Remove unused RetryRule from KafkaConsumerTestBase

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../streaming/connectors/kafka/FlinkKafkaProducerITCase.java     | 8 --------
 .../flink/streaming/connectors/kafka/KafkaConsumerTestBase.java  | 4 ----
 .../apache/flink/streaming/connectors/kafka/KafkaTestBase.java   | 9 +++++++++
 .../java/org/apache/flink/testutils/junit/RetryOnException.java  | 2 ++
 .../java/org/apache/flink/testutils/junit/RetryOnFailure.java    | 2 ++
 5 files changed, 13 insertions(+), 12 deletions(-)

[flink] 03/03: [FLINK-25134][test] Remove unused RetryRule from KafkaConsumerTestBase

Posted by fp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fpaul pushed a commit to branch release-1.14
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 0d9aed95ad0618ef190fd219251be0e068320a44
Author: Fabian Paul <fa...@ververica.com>
AuthorDate: Wed Dec 1 14:13:34 2021 +0100

    [FLINK-25134][test] Remove unused RetryRule from KafkaConsumerTestBase
    
    Before this commit the RetryRule actually prevented retries of tests
    inheriting from KafkaConsumerTestBase. Now, the retries are handled by
    KafkaTestBase and all subclasses have the same retry behaviour.
---
 .../flink/streaming/connectors/kafka/KafkaConsumerTestBase.java       | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java b/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
index c231517..becb303 100644
--- a/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
+++ b/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
@@ -77,7 +77,6 @@ import org.apache.flink.streaming.util.serialization.KeyedSerializationSchema;
 import org.apache.flink.streaming.util.serialization.TypeInformationKeyValueSerializationSchema;
 import org.apache.flink.test.util.SuccessException;
 import org.apache.flink.testutils.junit.RetryOnException;
-import org.apache.flink.testutils.junit.RetryRule;
 import org.apache.flink.util.Collector;
 import org.apache.flink.util.ExceptionUtils;
 
@@ -94,7 +93,6 @@ import org.apache.kafka.common.errors.NotLeaderForPartitionException;
 import org.apache.kafka.common.errors.TimeoutException;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Rule;
 
 import javax.annotation.Nullable;
 import javax.management.MBeanServer;
@@ -133,8 +131,6 @@ import static org.junit.Assert.fail;
 public abstract class KafkaConsumerTestBase extends KafkaTestBaseWithFlink {
     protected final boolean useNewSource;
 
-    @Rule public RetryRule retryRule = new RetryRule();
-
     private ClusterClient<?> client;
 
     protected KafkaConsumerTestBase() {

[flink] 02/03: [FLINK-15493][test] Add retry rule for all tests based on KafkaTestBase

Posted by fp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fpaul pushed a commit to branch release-1.14
in repository https://gitbox.apache.org/repos/asf/flink.git

commit a67afb20402040f4c489dad7285308439c4776e8
Author: Fabian Paul <fa...@ververica.com>
AuthorDate: Tue Nov 30 10:25:56 2021 +0100

    [FLINK-15493][test] Add retry rule for all tests based on KafkaTestBase
---
 .../streaming/connectors/kafka/FlinkKafkaProducerITCase.java     | 8 --------
 .../apache/flink/streaming/connectors/kafka/KafkaTestBase.java   | 9 +++++++++
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerITCase.java b/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerITCase.java
index e9217f7..3194d49 100644
--- a/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerITCase.java
+++ b/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerITCase.java
@@ -28,13 +28,10 @@ import org.apache.flink.streaming.connectors.kafka.internals.KeyedSerializationS
 import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
 import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
 import org.apache.flink.streaming.util.serialization.KeyedSerializationSchema;
-import org.apache.flink.testutils.junit.RetryOnFailure;
-import org.apache.flink.testutils.junit.RetryRule;
 
 import kafka.server.KafkaServer;
 import org.apache.kafka.common.errors.ProducerFencedException;
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
 
 import java.util.ArrayList;
@@ -57,13 +54,8 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
 /** IT cases for the {@link FlinkKafkaProducer}. */
-// This test is known to be unstable due to a known issue in Kafka.
-// It has been solved after bumping Kafka to 2.8.1 on the release 1.15
-@RetryOnFailure(times = 2)
 public class FlinkKafkaProducerITCase extends KafkaTestBase {
 
-    @Rule public final RetryRule retryRule = new RetryRule();
-
     protected String transactionalId;
     protected Properties extraProperties;
 
diff --git a/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestBase.java b/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestBase.java
index 9a38990..42d8a61 100644
--- a/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestBase.java
+++ b/flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestBase.java
@@ -27,6 +27,8 @@ import org.apache.flink.runtime.client.JobExecutionException;
 import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.util.TestStreamEnvironment;
 import org.apache.flink.test.util.SuccessException;
+import org.apache.flink.testutils.junit.RetryOnFailure;
+import org.apache.flink.testutils.junit.RetryRule;
 import org.apache.flink.util.InstantiationUtil;
 import org.apache.flink.util.TestLogger;
 
@@ -38,6 +40,7 @@ import org.apache.kafka.clients.producer.ProducerRecord;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,8 +72,12 @@ import static org.junit.Assert.fail;
  * href="https://github.com/sakserv/hadoop-mini-clusters">
  * https://github.com/sakserv/hadoop-mini-clusters</a> (ASL licensed), as per commit
  * <i>bc6b2b2d5f6424d5f377aa6c0871e82a956462ef</i>
+ *
+ * <p>Tests inheriting from this class are known to be unstable due to the test setup. All tests
+ * implemented in subclasses will be retried on failures.
  */
 @SuppressWarnings("serial")
+@RetryOnFailure(times = 3)
 public abstract class KafkaTestBase extends TestLogger {
 
     public static final Logger LOG = LoggerFactory.getLogger(KafkaTestBase.class);
@@ -89,6 +96,8 @@ public abstract class KafkaTestBase extends TestLogger {
 
     public static Properties secureProps = new Properties();
 
+    @Rule public final RetryRule retryRule = new RetryRule();
+
     // ------------------------------------------------------------------------
     //  Setup and teardown of the mini clusters
     // ------------------------------------------------------------------------

[flink] 01/03: [FLINK-15493][test] Inherit retry rule annotations to sub classes

Posted by fp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fpaul pushed a commit to branch release-1.14
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 42e0e58122d29bdca2f823a805e70e2f35e5d7e3
Author: Fabian Paul <fa...@ververica.com>
AuthorDate: Tue Nov 30 14:15:32 2021 +0100

    [FLINK-15493][test] Inherit retry rule annotations to sub classes
---
 .../main/java/org/apache/flink/testutils/junit/RetryOnException.java    | 2 ++
 .../src/main/java/org/apache/flink/testutils/junit/RetryOnFailure.java  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/junit/RetryOnException.java b/flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/junit/RetryOnException.java
index 74193ac..7a87267 100644
--- a/flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/junit/RetryOnException.java
+++ b/flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/junit/RetryOnException.java
@@ -19,6 +19,7 @@
 package org.apache.flink.testutils.junit;
 
 import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
@@ -60,6 +61,7 @@ import java.lang.annotation.Target;
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target({java.lang.annotation.ElementType.METHOD, ElementType.TYPE})
+@Inherited
 public @interface RetryOnException {
 
     int times();
diff --git a/flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/junit/RetryOnFailure.java b/flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/junit/RetryOnFailure.java
index 84c0614..ce9a0c6 100644
--- a/flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/junit/RetryOnFailure.java
+++ b/flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/junit/RetryOnFailure.java
@@ -19,6 +19,7 @@
 package org.apache.flink.testutils.junit;
 
 import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
@@ -53,6 +54,7 @@ import java.lang.annotation.Target;
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target({java.lang.annotation.ElementType.METHOD, ElementType.TYPE})
+@Inherited
 public @interface RetryOnFailure {
     int times();
 }