diff options
author | Håvard Pettersen <havardpe@oath.com> | 2019-01-10 14:46:07 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2019-01-10 14:46:07 +0000 |
commit | ebda4b1e3c42cfc1229b72009f0d33dd166c72c7 (patch) | |
tree | e4e754d0aa3c1329808b26b53a1a6a9a17a01228 /jrt/tests | |
parent | dae4281d6f6d2c3eece000d052788e147c9f7580 (diff) |
more robust testing
- add volatile to ensure visibility
- try for longer to ensure wanted state is reached also when load is high
- sleep for shorter to make test run faster and also protect against interruptions
Diffstat (limited to 'jrt/tests')
-rw-r--r-- | jrt/tests/com/yahoo/jrt/SessionTest.java | 6 | ||||
-rw-r--r-- | jrt/tests/com/yahoo/jrt/Test.java | 24 |
2 files changed, 15 insertions, 15 deletions
diff --git a/jrt/tests/com/yahoo/jrt/SessionTest.java b/jrt/tests/com/yahoo/jrt/SessionTest.java index 368e898978a..6f070959d7a 100644 --- a/jrt/tests/com/yahoo/jrt/SessionTest.java +++ b/jrt/tests/com/yahoo/jrt/SessionTest.java @@ -23,7 +23,7 @@ public class SessionTest implements SessionHandler { } private static class Session { - private static int cnt = 0; + private static volatile int cnt = 0; private static boolean error = false; private int value = 0; @@ -235,7 +235,7 @@ public class SessionTest implements SessionHandler { int clientFiniCount) { server.transport().sync().sync(); client.transport().sync().sync(); - for (int i = 0; i < 100; i++) { + for (int i = 0; i < 12000; i++) { if ((sessionCount == Session.cnt() || sessionCount < 0) && (serverInitCount == server.initCount || serverInitCount < 0) && (serverLiveCount == server.liveCount || serverLiveCount < 0) && @@ -247,7 +247,7 @@ public class SessionTest implements SessionHandler { (clientFiniCount == client.finiCount || clientFiniCount < 0)) { break; } - try { Thread.sleep(100); } catch (InterruptedException e) {} + try { Thread.sleep(10); } catch (InterruptedException e) {} } server.transport().sync().sync(); client.transport().sync().sync(); diff --git a/jrt/tests/com/yahoo/jrt/Test.java b/jrt/tests/com/yahoo/jrt/Test.java index efde0c57912..d797bd6d1c9 100644 --- a/jrt/tests/com/yahoo/jrt/Test.java +++ b/jrt/tests/com/yahoo/jrt/Test.java @@ -13,18 +13,18 @@ public class Test { * testing. **/ public static class Orb extends Supervisor { - public int initCount = 0; - public int liveCount = 0; - public int readRequestCount = 0; - public int readReplyCount = 0; - public int readErrorCount = 0; - public long readBytes = 0; - public int writeRequestCount = 0; - public int writeReplyCount = 0; - public int writeErrorCount = 0; - public long writeBytes = 0; - public int downCount = 0; - public int finiCount = 0; + public volatile int initCount = 0; + public volatile int liveCount = 0; + public volatile int readRequestCount = 0; + public volatile int readReplyCount = 0; + public volatile int readErrorCount = 0; + public volatile long readBytes = 0; + public volatile int writeRequestCount = 0; + public volatile int writeReplyCount = 0; + public volatile int writeErrorCount = 0; + public volatile long writeBytes = 0; + public volatile int downCount = 0; + public volatile int finiCount = 0; public Orb(Transport t) { super(t); |