Skip to content

Commit

Permalink
Fix tests in the LocalDockerEvaluationStrategy...
Browse files Browse the repository at this point in the history
... by correctly using the boolean attribute to manage the new use-case
introduced by @fbenoit in master.

Signed-off-by: David Festal <dfestal@redhat.com>
  • Loading branch information
davidfestal authored and sunix committed Jun 20, 2017
1 parent 4ef01e4 commit e8a79a6
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public abstract class BaseServerEvaluationStrategy extends ServerEvaluationStrat
/**
* Option to enable the use of the container address, when searching for addresses.
*/
private boolean useContainerAddress;
private boolean localDockerMode;


/**
Expand Down Expand Up @@ -129,13 +129,13 @@ public BaseServerEvaluationStrategy(String cheDockerIp,
String cheDockerCustomExternalTemplate,
String cheDockerCustomExternalProtocol,
String chePort,
boolean useContainerAddress) {
boolean localDockerMode) {
this.cheDockerIp = cheDockerIp;
this.cheDockerIpExternal = cheDockerIpExternal;
this.chePort = chePort;
this.cheDockerCustomExternalTemplate = cheDockerCustomExternalTemplate;
this.cheDockerCustomExternalProtocol = cheDockerCustomExternalProtocol;
this.useContainerAddress = useContainerAddress;
this.localDockerMode = localDockerMode;
}

@Override
Expand All @@ -144,7 +144,7 @@ protected Map<String, String> getInternalAddressesAndPorts(ContainerInfo contain

final String internalAddress;

if (useContainerAddress) {
if (localDockerMode) {
internalAddress = !isNullOrEmpty(internalAddressContainer) ?
internalAddressContainer :
internalHost;
Expand All @@ -155,7 +155,7 @@ protected Map<String, String> getInternalAddressesAndPorts(ContainerInfo contain
internalHost;
}

boolean useExposedPorts = useContainerAddress && internalAddress != internalHost;
boolean useExposedPorts = localDockerMode && internalAddress != internalHost;

return getExposedPortsToAddressPorts(internalAddress, containerInfo.getNetworkSettings().getPorts(), useExposedPorts);
}
Expand Down Expand Up @@ -285,21 +285,22 @@ protected OnlineRenderingEvaluation withInternalHost(String internalHost) {

@Override
public String getExternalAddress() {
if (useContainerAddress) {
if (localDockerMode) {
return cheDockerIpExternal != null ?
cheDockerIpExternal :
cheDockerIp != null ?
cheDockerIp :
!isNullOrEmpty(gatewayAddressContainer) ?
gatewayAddressContainer :
this.internalHost;
}

return cheDockerIpExternal != null ?
cheDockerIpExternal :
cheDockerIp != null ?
cheDockerIp :
this.internalHost;
cheDockerIpExternal :
cheDockerIp != null ?
cheDockerIp :
!isNullOrEmpty(gatewayAddressContainer) ?
gatewayAddressContainer :
this.internalHost;

}
}

Expand Down

0 comments on commit e8a79a6

Please sign in to comment.