You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2019/04/29 06:50:13 UTC
[atlas] branch branch-2.0 updated: ATLAS-3168: Fix intermittent UT
failure: KafkaNotificationTest.initNotificationService()
This is an automated email from the ASF dual-hosted git repository.
sarath pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 58e2e21 ATLAS-3168: Fix intermittent UT failure: KafkaNotificationTest.initNotificationService()
58e2e21 is described below
commit 58e2e21eb1c9e549f0b77b61ce9282c1585c7e9a
Author: Sarath Subramanian <ss...@hortonworks.com>
AuthorDate: Sun Apr 28 23:49:34 2019 -0700
ATLAS-3168: Fix intermittent UT failure: KafkaNotificationTest.initNotificationService()
(cherry picked from commit ed288a759c556c704c824eb921c81b563a32f3e9)
---
.../apache/atlas/kafka/KafkaNotificationTest.java | 27 +++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java b/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java
index 63114bf..9b3535e 100644
--- a/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java
+++ b/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java
@@ -40,7 +40,7 @@ public class KafkaNotificationTest {
@BeforeClass
public void setup() throws Exception {
- initNotificationService();
+ startNotificationServicesWithRetry();
}
@AfterClass
@@ -77,6 +77,31 @@ public class KafkaNotificationTest {
consumer.close();
}
+ // retry starting notification services every 2 mins for total of 20 mins
+ // running parallel tests will keep the notification service ports occupied, hence retry
+ void startNotificationServicesWithRetry() throws Exception {
+ long totalTime = 0;
+ long sleepTime = 2 * 60 * 1000; // 2 mins
+ long maxTime = 20 * 60 * 1000; // 20 mins
+
+ while (true) {
+ try {
+ initNotificationService();
+ break;
+ } catch (Exception ex) {
+ cleanUpNotificationService();
+
+ if (totalTime >= maxTime) {
+ throw ex;
+ }
+
+ Thread.sleep(sleepTime);
+
+ totalTime = totalTime + sleepTime;
+ }
+ }
+ }
+
void initNotificationService() throws Exception {
Configuration applicationProperties = ApplicationProperties.get();