mirror of https://github.com/apache/nifi.git
NIFI-557: modified unit test to connect to localhost, rather than the IP address of localhost, as DNS and multiple NIC cards can cause unit tests to fail otherwise
This commit is contained in:
parent
73a368f861
commit
6394c8ee40
|
@ -95,11 +95,10 @@ public class ClusterManagerProtocolSenderImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRequestFlow() throws Exception {
|
public void testRequestFlow() throws Exception {
|
||||||
|
|
||||||
when(mockHandler.canHandle(any(ProtocolMessage.class))).thenReturn(Boolean.TRUE);
|
when(mockHandler.canHandle(any(ProtocolMessage.class))).thenReturn(Boolean.TRUE);
|
||||||
when(mockHandler.handle(any(ProtocolMessage.class))).thenReturn(new FlowResponseMessage());
|
when(mockHandler.handle(any(ProtocolMessage.class))).thenReturn(new FlowResponseMessage());
|
||||||
final FlowRequestMessage request = new FlowRequestMessage();
|
final FlowRequestMessage request = new FlowRequestMessage();
|
||||||
request.setNodeId(new NodeIdentifier("id", "api-address", 1, address.getHostAddress(), port));
|
request.setNodeId(new NodeIdentifier("id", "api-address", 1, "localhost", port));
|
||||||
final FlowResponseMessage response = sender.requestFlow(request);
|
final FlowResponseMessage response = sender.requestFlow(request);
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +109,7 @@ public class ClusterManagerProtocolSenderImplTest {
|
||||||
when(mockHandler.canHandle(any(ProtocolMessage.class))).thenReturn(Boolean.TRUE);
|
when(mockHandler.canHandle(any(ProtocolMessage.class))).thenReturn(Boolean.TRUE);
|
||||||
when(mockHandler.handle(any(ProtocolMessage.class))).thenReturn(new PingMessage());
|
when(mockHandler.handle(any(ProtocolMessage.class))).thenReturn(new PingMessage());
|
||||||
final FlowRequestMessage request = new FlowRequestMessage();
|
final FlowRequestMessage request = new FlowRequestMessage();
|
||||||
request.setNodeId(new NodeIdentifier("id", "api-address", 1, address.getHostAddress(), port));
|
request.setNodeId(new NodeIdentifier("id", "api-address", 1, "localhost", port));
|
||||||
try {
|
try {
|
||||||
sender.requestFlow(request);
|
sender.requestFlow(request);
|
||||||
fail("failed to throw exception");
|
fail("failed to throw exception");
|
||||||
|
@ -134,7 +133,7 @@ public class ClusterManagerProtocolSenderImplTest {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
final FlowRequestMessage request = new FlowRequestMessage();
|
final FlowRequestMessage request = new FlowRequestMessage();
|
||||||
request.setNodeId(new NodeIdentifier("id", "api-address", 1, address.getHostAddress(), port));
|
request.setNodeId(new NodeIdentifier("id", "api-address", 1, "localhost", port));
|
||||||
try {
|
try {
|
||||||
sender.requestFlow(request);
|
sender.requestFlow(request);
|
||||||
fail("failed to throw exception");
|
fail("failed to throw exception");
|
||||||
|
|
Loading…
Reference in New Issue