Skip to content

Commit

Permalink
use right pattern for rabbit custom config
Browse files Browse the repository at this point in the history
see #1690
  • Loading branch information
twillouer committed Aug 3, 2019
1 parent f7e0eed commit 323f9d9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Expand Up @@ -348,12 +348,12 @@ public RabbitMQContainer withExchange(String name, String type, boolean autoDele
/**
* Overwrites the default RabbitMQ configuration file with the supplied one
*
* @param rabbitMQConf The rabbitmq.conf file to use
* @param rabbitMQConf The rabbitmq.config file to use
* @return This container.
*/
public RabbitMQContainer withRabbitMQConfig(MountableFile rabbitMQConf) {
withEnv("RABBITMQ_CONFIG_FILE", "/etc/rabbitmq/rabbitmq-custom.conf");
return withCopyFileToContainer(rabbitMQConf, "/etc/rabbitmq/rabbitmq-custom.conf");
withEnv("RABBITMQ_CONFIG_FILE", "/etc/rabbitmq/rabbitmq-custom.config");
return withCopyFileToContainer(rabbitMQConf, "/etc/rabbitmq/rabbitmq-custom.config");
}

@NotNull
Expand Down
Expand Up @@ -108,7 +108,8 @@ public void shouldMountConfigurationFile() {
container.withRabbitMQConfig(MountableFile.forClasspathResource("/rabbitmq-custom.conf"));
container.start();

assertThat(container.getLogs().contains("/etc/rabbitmq/rabbitmq-custom.conf")).isTrue();
assertThat(container.getLogs()).contains("config file(s) : /etc/rabbitmq/rabbitmq-custom.config");
assertThat(container.getLogs()).doesNotContain(" (not found)");
}
}

Expand Down
15 changes: 13 additions & 2 deletions modules/rabbitmq/src/test/resources/rabbitmq-custom.conf
@@ -1,2 +1,13 @@
loopback_users.guest = false
listeners.tcp.default = 5555
[
{ rabbit, [
{ loopback_users, [ ] },
{ tcp_listeners, [ 5555 ] },
{ ssl_listeners, [ ] },
{ default_vhost, <<"vhost">> },
{ hipe_compile, false }
] },
{ rabbitmq_management, [ { listener, [
{ port, 15672 },
{ ssl, false }
] } ] }
].

0 comments on commit 323f9d9

Please sign in to comment.