Skip to content

Commit 260a30b

Browse files
committed
Fix Permissions#passiveDeclaration test
Any permission works for passive declaration (Rmq 4.2.7+, 4.3.1+) but at least one permission is required. References rabbitmq/rabbitmq-server#16272
1 parent a9c266e commit 260a30b

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,12 @@ public void queueConfiguration() throws IOException {
165165

166166
@Test
167167
public void passiveDeclaration(TestInfo info) throws IOException {
168-
if (TestUtils.isVersion426orLater(connection)) {
169-
runTest(true, false, false, false, name -> channel.exchangeDeclarePassive(name));
170-
runTest(true, false, false, false, name -> channel.queueDeclarePassive(name));
168+
if (TestUtils.isVersion431orLater(connection)) {
169+
// any permission works for passive declaration (Rmq 4.2.7+, 4.3.1+)
170+
// but at least one permission required
171+
// see https://github.com/rabbitmq/rabbitmq-server/pull/16272
172+
runTest(true, true, true, false, name -> channel.exchangeDeclarePassive(name));
173+
runTest(true, true, true, false, name -> channel.queueDeclarePassive(name));
171174
} else {
172175
LOGGER.info(
173176
"Skipping {}.{} test",
@@ -290,12 +293,17 @@ private void runConfigureTest(WithName test) throws IOException {
290293
runTest(false, "none", test);
291294
}
292295

293-
private void runTest(boolean expC, boolean expW, boolean expR, boolean expN, WithName test)
296+
private void runTest(
297+
boolean shouldPassC,
298+
boolean shouldPassW,
299+
boolean shouldPassR,
300+
boolean shouldPassNone,
301+
WithName test)
294302
throws IOException {
295-
runTest(expC, CONFIGURE_PERMISSION, test);
296-
runTest(expW, WRITE_PERMISSION, test);
297-
runTest(expR, READ_PERMISSION, test);
298-
runTest(expN, "none", test);
303+
runTest(shouldPassC, CONFIGURE_PERMISSION, test);
304+
runTest(shouldPassW, WRITE_PERMISSION, test);
305+
runTest(shouldPassR, READ_PERMISSION, test);
306+
runTest(shouldPassNone, "none", test);
299307
}
300308

301309
private void assertAccessRefused(WithName test) throws IOException {

0 commit comments

Comments
 (0)