Skip to content

Commit d0f077f

Browse files
committed
Merge branch '4.0.x-stable' into 4.1.x-stable
2 parents 6087858 + abb2b88 commit d0f077f

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.io.IOException;
2323
import java.util.concurrent.TimeoutException;
2424

25+
import com.rabbitmq.client.Channel;
2526
import org.junit.Test;
2627

2728
import com.rabbitmq.client.AMQP;
@@ -55,7 +56,8 @@ public class AbsentQueue extends ClusteredTestBase {
5556
alternateChannel.queueDelete(Q);
5657
}
5758

58-
@Test public void notFound() throws IOException {
59+
@Test public void notFound() throws IOException, InterruptedException {
60+
waitPropagationInHa();
5961
assertNotFound(new Task() {
6062
public void run() throws IOException {
6163
channel.queueDeclare(Q, true, false, false, null);
@@ -96,8 +98,26 @@ protected void assertNotFound(Task t) throws IOException {
9698

9799
}
98100

101+
private void waitPropagationInHa() throws IOException, InterruptedException {
102+
// can be necessary to wait a bit in HA mode
103+
if (HATests.HA_TESTS_RUNNING) {
104+
long waited = 0;
105+
while(waited < 5000) {
106+
Channel tempChannel = connection.createChannel();
107+
try {
108+
tempChannel.queueDeclarePassive(Q);
109+
break;
110+
} catch (IOException e) {
111+
112+
}
113+
Thread.sleep(10);
114+
waited += 10;
115+
}
116+
}
117+
}
118+
99119
private interface Task {
100-
public void run() throws IOException;
120+
void run() throws IOException;
101121
}
102122

103123
}

0 commit comments

Comments
 (0)