Skip to content

Commit 1e73353

Browse files
committed
Disable test with queue deletion in transaction
For RabbitMQ 3.13+. (cherry picked from commit 84dfb06)
1 parent e74b63f commit 1e73353

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

src/test/java/com/rabbitmq/client/test/TestUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ public static void abort(Connection connection) {
116116
}
117117
}
118118

119+
public static boolean atMost312(Connection connection) {
120+
return atMostVersion("3.12.999", currentVersion(connection.getServerProperties().get("version").toString()));
121+
}
122+
119123
public static boolean isVersion37orLater(Connection connection) {
120124
return atLeastVersion("3.7.0", connection);
121125
}
@@ -141,6 +145,15 @@ private static boolean atLeastVersion(String expectedVersion, String currentVers
141145
}
142146
}
143147

148+
private static boolean atMostVersion(String expectedVersion, String currentVersion) {
149+
try {
150+
return versionCompare(currentVersion, expectedVersion) <= 0;
151+
} catch (RuntimeException e) {
152+
LoggerFactory.getLogger(TestUtils.class).warn("Unable to parse broker version {}", currentVersion, e);
153+
throw e;
154+
}
155+
}
156+
144157
static String currentVersion(String currentVersion) {
145158
// versions built from source: 3.7.0+rc.1.4.gedc5d96
146159
if (currentVersion.contains("+")) {

src/test/java/com/rabbitmq/client/test/functional/Transactions.java

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

26+
import com.rabbitmq.client.test.TestUtils;
2627
import org.junit.jupiter.api.Test;
2728

2829
import com.rabbitmq.client.AMQP;
@@ -329,18 +330,20 @@ private long[] publishSelectAndGet(int n)
329330

330331
@Test public void commitWithDeletedQueue()
331332
throws IOException, TimeoutException {
332-
txSelect();
333-
basicPublish();
334-
releaseResources();
335-
try {
336-
txCommit();
337-
} catch (IOException e) {
338-
closeConnection();
339-
openConnection();
340-
openChannel();
341-
fail("commit failed");
342-
} finally {
343-
createResources(); // To allow teardown to function cleanly
333+
if (TestUtils.atMost312(connection)) {
334+
txSelect();
335+
basicPublish();
336+
releaseResources();
337+
try {
338+
txCommit();
339+
} catch (IOException e) {
340+
closeConnection();
341+
openConnection();
342+
openChannel();
343+
fail("commit failed");
344+
} finally {
345+
createResources(); // To allow teardown to function cleanly
346+
}
344347
}
345348
}
346349

0 commit comments

Comments
 (0)