Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Adding "autoRemove" field for HostConfiguration. #526

Closed
wants to merge 3 commits into from
Closed

Adding "autoRemove" field for HostConfiguration. #526

wants to merge 3 commits into from

Conversation

diemol
Copy link
Contributor

@diemol diemol commented Oct 12, 2016

Hi,

Regarding the discussion related to this question I had some weeks ago, here is the PR addressing that field I was asking for and that will be added in the API v.1.25.

I added also a small unit test to check the field.

final ContainerCreation container = sut.createContainer(config, randomName());
final ContainerInfo info = sut.inspectContainer(container.id());

assertThat(info.hostConfig().autoRemove(), is(true));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this test, you are just setting the option on container creation and verifying that it was indeed set correctly. A better test would be to start and stop the container, verifying that it does get removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, the test I wrote was quite naive. Anyway, I improved it a bit and just made the commit.
Thanks for the feedback.

@codecov-io
Copy link

codecov-io commented Oct 13, 2016

Current coverage is 45.79% (diff: 16.66%)

Merging #526 into master will decrease coverage by 0.01%

@@             master       #526   diff @@
==========================================
  Files           131        131          
  Lines          4294       4300     +6   
  Methods           0          0          
  Messages          0          0          
  Branches        636        636          
==========================================
+ Hits           1967       1969     +2   
- Misses         2139       2143     +4   
  Partials        188        188          

Powered by Codecov. Last update ced23d4...d849ce2

Copy link
Member

@mattnworb mattnworb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @diemol for the contribution!

One small question: it looks to me like 1.25 of the API isn't out yet, so there likely wouldn't be an easy way for us to test this change in Travis until there is a docker release of that API version, or would you know how it could be tested?

@diemol
Copy link
Contributor Author

diemol commented Nov 7, 2016

Hi @mattnworb,

To test it locally I just faked the behaviour as if the flag was implemented. But I think this does not make sense in the CI and overall, honestly, I would just wait until it gets released.

Right now I have a workaround for that missing feature, so I don't need it urgently, it is more a nice to have.

Thanks for the nice work you are doing over there, this docker-client simplified my life a lot in the project I am working, so the least I could do is to five something back 😄

return autoRemove;
}

public Builder autoRemove(final Boolean autoRemove) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought I am happy to merge this now, in advance of the 1.25 API being released, but would you mind adding a javadoc comment here that this field only has relevance for versions >= 1.25?

Copy link
Contributor Author

@diemol diemol Nov 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll do it between today and tomorrow.

@davidxia
Copy link
Contributor

davidxia commented Nov 9, 2016

Thanks, @diemol. I've added the javadoc here #538

@davidxia davidxia closed this Nov 9, 2016
@diemol
Copy link
Contributor Author

diemol commented Nov 9, 2016

Ah cool @davidxia, you were faster! Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants