Skip to content

Commit 3bd1bfd

Browse files
committed
Display Khepri information
1 parent c9a9ca4 commit 3bd1bfd

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/test/java/com/rabbitmq/client/amqp/impl/Cli.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ static String rabbitmqStreamsCommand() {
8787
return rabbitmqctl.substring(0, lastIndex) + "rabbitmq-streams";
8888
}
8989

90+
static ProcessState rabbitmqctl(String command, String node) {
91+
return executeCommand(replaceContainerId(rabbitmqctlCommand(), node) + " " + command);
92+
}
93+
9094
static ProcessState rabbitmqctl(String command) {
9195
return executeCommand(rabbitmqctlCommand() + " " + command);
9296
}
@@ -227,15 +231,20 @@ static void deleteQuorumQueueMember(String queue, String node) {
227231
}
228232

229233
static String quorumStatus(String queue, String node) {
234+
String cmd = replaceContainerId(rabbitmqQueuesCommand(), node);
235+
return executeCommand(cmd + " quorum_status --formatter erlang " + queue).output();
236+
}
237+
238+
private static String replaceContainerId(String cmd, String node) {
230239
String containerId = DOCKER_NODES_TO_CONTAINERS.get(node);
231240
Assert.notNull(containerId, "Container ID for node " + node);
232-
String cmd = rabbitmqQueuesCommand();
233241
for (String value : DOCKER_NODES_TO_CONTAINERS.values()) {
234242
if (cmd.contains("docker exec " + value)) {
235243
cmd = cmd.replace("docker exec " + value, "docker exec " + containerId);
244+
break;
236245
}
237246
}
238-
return executeCommand(cmd + " quorum_status --formatter erlang " + queue).output();
247+
return cmd;
239248
}
240249

241250
static void addStreamMember(String stream, String node) {

src/test/java/com/rabbitmq/client/amqp/impl/ClusterTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ void consumeFromQuorumQueueWhenLeaderIsPaused() throws InterruptedException {
381381
+ "queue info "
382382
+ mgmt.queueInfo(q));
383383
} finally {
384+
System.out.println(
385+
Cli.rabbitmqctl("eval 'khepri:info(rabbitmq_metadata).'", initialFollowers.get(0))
386+
.output());
384387
System.out.println(Cli.quorumStatus(q, initialFollowers.get(0)));
385388
if (nodePaused) {
386389
Cli.unpauseNode(initialLeader);

0 commit comments

Comments
 (0)