-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Also add fixed COLUMNS to localMachine #511
base: master
Are you sure you want to change the base?
Conversation
To fix issue with docker-compose when system terminal is narrow. Also harmonize code according to RemoteBuilder.build.
Generate changelog in
|
Oops, wrong order
Unit tests are failing but this seems unrelated? |
return new DockerMachine(dockerType.resolveIp(dockerHost), ImmutableMap.copyOf(combinedEnvironment)); | ||
String hostIp = dockerType.resolveIp(dockerHost); | ||
|
||
Map<String, String> environment = ImmutableMap.<String, String>builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @cfredri4!
For reference, this is the failing test:
Lines 114 to 128 in 915c47f
@Test | |
public void override_system_environment_with_additional_environment() { | |
Map<String, String> systemEnv = ImmutableMap.<String, String>builder() | |
.put("ENV_1", "VAL_1") | |
.build(); | |
Map<String, String> overrideEnv = ImmutableMap.<String, String>builder() | |
.put("ENV_1", "DIFFERENT_VALUE") | |
.build(); | |
DockerMachine localMachine = new LocalBuilder(DAEMON, systemEnv) | |
.withEnvironment(overrideEnv) | |
.build(); | |
assertThat(localMachine, not(containsEnvironment(systemEnv))); | |
assertThat(localMachine, containsEnvironment(overrideEnv)); | |
} |
It fails because it expects to override variables in the systemEnvironment
with variables from the additionalEnvironment
when both contain the same key. Previously, we used a HashMap
for combining the environments, which allowed to overwrite an existing key with a new key-value pair.
When using ImmutableMap#builder
, this is not allowed and results in an exception.
I would continue using the HashMap
for building the combined environment as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! Did this change in order to harmonize LocalBuilder and RemoteBuilder.
Now changed to allow same functionality in RemoteBuilder instead. ;-)
After review comment Instead harmonize RemoteBuilder with LocalBuilder
To fix issue with docker-compose when system terminal is narrow. Also harmonize code according to RemoteBuilder.build.
Before this PR
Parsing of docker-compose output fails when system terminal is narrow
After this PR
==COMMIT_MSG==
Make parsing of docker-compose output independent of local system terminal column width.
==COMMIT_MSG==
Possible downsides?
Probably none.