Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
fb54a29d
Commit
fb54a29d
authored
Aug 04, 2019
by
Sarath Subramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3168: Fix intermittent UT failure:…
ATLAS-3168: Fix intermittent UT failure: NotificationHookConsumerKafkaTest.initNotificationService()
parent
f0b0b951
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
NotificationHookConsumerKafkaTest.java
...atlas/notification/NotificationHookConsumerKafkaTest.java
+27
-2
No files found.
webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
View file @
fb54a29d
...
...
@@ -85,7 +85,7 @@ public class NotificationHookConsumerKafkaTest {
private
AtlasMetricsUtil
metricsUtil
;
@BeforeTest
public
void
setup
()
throws
AtlasException
,
InterruptedException
,
AtlasBase
Exception
{
public
void
setup
()
throws
Exception
{
MockitoAnnotations
.
initMocks
(
this
);
AtlasType
mockType
=
mock
(
AtlasType
.
class
);
...
...
@@ -95,7 +95,7 @@ public class NotificationHookConsumerKafkaTest {
when
(
instanceConverter
.
toAtlasEntities
(
anyList
())).
thenReturn
(
mockEntity
);
initNotificationService
();
startNotificationServicesWithRetry
();
}
@AfterTest
...
...
@@ -228,6 +228,31 @@ public class NotificationHookConsumerKafkaTest {
kafkaNotification
.
send
(
NotificationInterface
.
NotificationType
.
HOOK
,
message
);
}
// retry starting notification services every 2 mins for total of 30 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
=
30
*
60
*
1000
;
// 30 mins
while
(
true
)
{
try
{
initNotificationService
();
break
;
}
catch
(
Exception
ex
)
{
cleanUpNotificationService
();
if
(
totalTime
>=
maxTime
)
{
throw
ex
;
}
Thread
.
sleep
(
sleepTime
);
totalTime
=
totalTime
+
sleepTime
;
}
}
}
void
initNotificationService
()
throws
AtlasException
,
InterruptedException
{
Configuration
applicationProperties
=
ApplicationProperties
.
get
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment