diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-02-21 14:27:47 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-02-21 14:27:57 +0100 |
commit | 8bd2a1514fcdf7604706f899ca96697a77b41731 (patch) | |
tree | d05240184c4de49129c5be2609e575df0077735c /container-accesslogging | |
parent | 9c37326604592f569f176275a479f1e19d6d4de8 (diff) |
Reduce use of long sleep periods
Diffstat (limited to 'container-accesslogging')
-rw-r--r-- | container-accesslogging/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/container-accesslogging/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java b/container-accesslogging/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java index 6ef1c3ef2a1..b401f8a914e 100644 --- a/container-accesslogging/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java +++ b/container-accesslogging/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java @@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Bob Travis * @author bjorncs */ -// TODO: Make these tests wait until the right things happen rather than waiting for a predetermined time public class LogFileHandlerTestCase { @Rule @@ -131,14 +130,14 @@ public class LogFileHandlerTestCase { } lr = new LogRecord(Level.INFO, "string which is way longer than the word test"); h.publish(lr); - Thread.sleep(1000); + h.waitDrained(); File f = new File(f1); long first = f.length(); f = new File(f2); long second = f.length(); final long secondLength = 72; for (int n = 0; n < 20 && second != secondLength; ++n) { - Thread.sleep(1000); + Thread.sleep(1); second = f.length(); } f = new File(root, "symlink"); @@ -177,7 +176,7 @@ public class LogFileHandlerTestCase { assertThat(content).hasLineCount(logEntries); h.rotateNow(); while (uncompressed.exists()) { - Thread.sleep(10); + Thread.sleep(1); } assertThat(compressed).exists(); String unzipped = IOUtils.readAll(new InputStreamReader(new GZIPInputStream(new FileInputStream(compressed)))); |