From 411816f4a91ab9058751fdb89131f7dfee448342 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 10 Jan 2018 16:06:58 -0500 Subject: [PATCH] Fix `testCloudProfile` to connect to "localhost" When we don't specify the `host` property for the `CachingConnectionFactory`, it is selected by the `InetAddress.getLocalHost().getHostName()`, which might not be "localhost" as it is allowed for the `guest` user on RabbitMQ. This also may cause some unexpected loop-backs on the network interface during connection attempt **Cherry-pick to 1.3.x** --- .../binder/rabbit/integration/RabbitBinderModuleTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/integration/RabbitBinderModuleTests.java b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/integration/RabbitBinderModuleTests.java index 2e5804820..3b96633df 100644 --- a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/integration/RabbitBinderModuleTests.java +++ b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/integration/RabbitBinderModuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -291,7 +291,7 @@ public class RabbitBinderModuleTests { public Cloud cloud() { Cloud cloud = mock(Cloud.class); - willReturn(new CachingConnectionFactory()) + willReturn(new CachingConnectionFactory("localhost")) .given(cloud) .getSingletonServiceConnector(ConnectionFactory.class, null);