Fix failing developer tools tests

Tweak timings for some tests to fix failures that only occur on Linux
machines.

See gh-3082
pull/3077/merge
Phillip Webb 10 years ago
parent 247d2d6a2d
commit 36007a4057

@ -91,10 +91,10 @@ public class RestarterTests {
}; };
thread.start(); thread.start();
Thread.sleep(1600); Thread.sleep(2600);
String output = this.out.toString(); String output = this.out.toString();
assertThat(StringUtils.countOccurrencesOf(output, "Tick 0"), greaterThan(2)); assertThat(StringUtils.countOccurrencesOf(output, "Tick 0"), greaterThan(1));
assertThat(StringUtils.countOccurrencesOf(output, "Tick 1"), greaterThan(2)); assertThat(StringUtils.countOccurrencesOf(output, "Tick 1"), greaterThan(1));
} }
@Test @Test
@ -199,12 +199,12 @@ public class RestarterTests {
private static volatile boolean quit = false; private static volatile boolean quit = false;
@Scheduled(fixedDelay = 100) @Scheduled(fixedDelay = 200)
public void tickBean() { public void tickBean() {
System.out.println("Tick " + this.count++ + " " + Thread.currentThread()); System.out.println("Tick " + this.count++ + " " + Thread.currentThread());
} }
@Scheduled(initialDelay = 350, fixedDelay = 350) @Scheduled(initialDelay = 500, fixedDelay = 500)
public void restart() { public void restart() {
System.out.println("Restart " + Thread.currentThread()); System.out.println("Restart " + Thread.currentThread());
if (!SampleApplication.quit) { if (!SampleApplication.quit) {

@ -84,6 +84,7 @@ public class TunnelClientTests {
client.start(); client.start();
SocketChannel channel = SocketChannel SocketChannel channel = SocketChannel
.open(new InetSocketAddress(this.listenPort)); .open(new InetSocketAddress(this.listenPort));
Thread.sleep(200);
channel.close(); channel.close();
client.getServerThread().stopAcceptingConnections(); client.getServerThread().stopAcceptingConnections();
client.getServerThread().join(2000); client.getServerThread().join(2000);
@ -97,6 +98,7 @@ public class TunnelClientTests {
client.start(); client.start();
SocketChannel channel = SocketChannel SocketChannel channel = SocketChannel
.open(new InetSocketAddress(this.listenPort)); .open(new InetSocketAddress(this.listenPort));
Thread.sleep(200);
client.stop(); client.stop();
assertThat(this.tunnelConnection.getOpenedTimes(), equalTo(1)); assertThat(this.tunnelConnection.getOpenedTimes(), equalTo(1));
assertThat(this.tunnelConnection.isOpen(), equalTo(false)); assertThat(this.tunnelConnection.isOpen(), equalTo(false));
@ -111,6 +113,7 @@ public class TunnelClientTests {
client.start(); client.start();
SocketChannel channel = SocketChannel SocketChannel channel = SocketChannel
.open(new InetSocketAddress(this.listenPort)); .open(new InetSocketAddress(this.listenPort));
Thread.sleep(200);
channel.close(); channel.close();
client.getServerThread().stopAcceptingConnections(); client.getServerThread().stopAcceptingConnections();
client.getServerThread().join(2000); client.getServerThread().join(2000);

Loading…
Cancel
Save