Skip to content

Commit

Permalink
update code as suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Apr 12, 2024
1 parent a73ba2f commit d5971ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions java/src/org/openqa/selenium/docker/ContainerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ public ContainerConfig(
List<Device> devices,
String networkName,
long shmSize) {
this(image, portBindings, envVars, volumeBinds, devices, networkName, shmSize, new HashMap<>());
this(
image,
portBindings,
envVars,
volumeBinds,
devices,
networkName,
shmSize,
ImmutableMap.of());
}

public ContainerConfig(
Expand All @@ -73,7 +81,7 @@ public ContainerConfig(
this.networkName = networkName;
this.autoRemove = true;
this.shmSize = shmSize;
this.hostConfig = hostConfig;
this.hostConfig = hostConfig != null ? hostConfig : ImmutableMap.of();
}

public static ContainerConfig image(Image image) {
Expand Down Expand Up @@ -138,7 +146,7 @@ public ContainerConfig devices(List<Device> devices) {
image, portBindings, envVars, volumeBinds, devices, networkName, shmSize);
}

public ContainerConfig getHostConfig(Map<String, Object> hostConfig, List<String> configKeys) {
public ContainerConfig applyHostConfig(Map<String, Object> hostConfig, List<String> configKeys) {
Map<String, Object> setHostConfig =
configKeys.stream()
.filter(hostConfig::containsKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private Container createBrowserContainer(
.shmMemorySize(browserContainerShmMemorySize)
.network(networkName)
.devices(devices)
.getHostConfig(hostConfig, hostConfigKeys);
.applyHostConfig(hostConfig, hostConfigKeys);
if (!runningInDocker) {
containerConfig = containerConfig.map(Port.tcp(4444), Port.tcp(port));
}
Expand Down

0 comments on commit d5971ea

Please sign in to comment.