Skip to content

Commit acb72b6

Browse files
committed
Ensure starting mock Fluentd
1 parent 52ed53f commit acb72b6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/java/org/fluentd/logger/sender/TestAsyncRawSocketSender.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public void process(MessagePack msgpack, Socket socket) throws IOException {
4949
}
5050
});
5151
fluentd.start();
52+
fluentd.waitUntilReady();
5253

5354
// start asyncSenders
5455
Sender asyncSender = new AsyncRawSocketSender("localhost", port);
@@ -111,6 +112,7 @@ public void process(MessagePack msgpack, Socket socket) throws IOException {
111112
}
112113
});
113114
fluentd.start();
115+
fluentd.waitUntilReady();
114116

115117
// start asyncSenders
116118
Sender asyncSender = new AsyncRawSocketSender("localhost", port);
@@ -162,6 +164,7 @@ public void process(MessagePack msgpack, Socket socket) throws IOException {
162164
}
163165
});
164166
fluentds[0].start();
167+
fluentds[0].waitUntilReady();
165168
ports[1] = MockFluentd.randomPort();
166169
elists[1] = new ArrayList<Event>();
167170
fluentds[1] = new MockFluentd(ports[1], new MockFluentd.MockProcess() {
@@ -180,6 +183,7 @@ public void process(MessagePack msgpack, Socket socket) throws IOException {
180183
}
181184
});
182185
fluentds[1].start();
186+
fluentds[1].waitUntilReady();
183187

184188
// start AsyncSenders
185189
Sender[] asyncSenders = new Sender[2];
@@ -272,6 +276,7 @@ public void process(MessagePack msgpack, Socket socket) throws IOException {
272276

273277
MockFluentd fluentd = new MockFluentd(port, mockProcess);
274278
fluentd.start();
279+
fluentd.waitUntilReady();
275280

276281
Sender asyncSender = new AsyncRawSocketSender("localhost", port);
277282
assertFalse(asyncSender.isConnected());
@@ -369,6 +374,7 @@ public void run() {
369374
try {
370375
bufferFull.await(20, TimeUnit.SECONDS);
371376
fluentd.start();
377+
fluentd.waitUntilReady();
372378
} catch (InterruptedException e) {
373379
e.printStackTrace();
374380
}

0 commit comments

Comments
 (0)