Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

use apiClient for various things #1982

Merged
merged 5 commits into from
Mar 29, 2016

Conversation

MHBauer
Copy link
Contributor

@MHBauer MHBauer commented Mar 16, 2016

engine-api has has the prune/noprune option. The matching behavior is to prune. Not sure if we want or need to make that option available with the pass through.

Not sure if the array of pointers vs array of objects needs to be looked at or if it's fine how it is.

@nishanttotla
Copy link
Contributor

Adding reference to #1879, this is part of implementing that proposal.

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 17, 2016

Yup, I should have marked that. I wanted to give a shot at starting. I might combine some more stuff into this as individual commits. I would like to get some basic eyes-on to start.

@nishanttotla
Copy link
Contributor

@MHBauer thanks for helping out with moving to the new client. I'm thinking that it would be a good idea to add some unit tests so that we can monitor these changes over time to ensure stability.

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 17, 2016

I'll have to think about how best to do that. I was mainly making sure the integration tests still ran, as I assume those are using the actual clients, vs what would probably be a mock here.

@MHBauer MHBauer changed the title use apiClient for removing images use apiClient for various things Mar 17, 2016
@nishanttotla
Copy link
Contributor

@MHBauer that's correct, but unit tests are valuable to catch certain issues integration tests won't. Your changes seem to be isolated enough so it may not be a problem, but in general it would be nice to have unit tests in all packages that use the new client.

@@ -471,17 +473,17 @@ func (e *Engine) updateSpecs() error {
}

// RemoveImage deletes an image from the engine.
func (e *Engine) RemoveImage(image *Image, name string, force bool) ([]*dockerclient.ImageDelete, error) {
array, err := e.client.RemoveImage(name, force)
func (e *Engine) RemoveImage(image *Image, name string, force bool) ([]types.ImageDelete, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the purpose if the image *Image parameter? It wasn't used before, and it's not used after.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point, seems like a redundant argument. You can consider removing it. I'm surprised the compiler didn't complain about it before.

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 18, 2016

@nishanttotla test added for RemoveImage. I'm not terribly convinced of it's worth considering the work involved. I suppose it does make sure we're calling the one client vs the other.

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 18, 2016

I think this is enough for one PR. @docker/core-swarm-maintainers for review, please.

@nishanttotla
Copy link
Contributor

@MHBauer sorry for the inconvenience, but could you add wait to rebase until #1996 is merged? Since we're now moving many function calls to engine-api, we should keep up to date with changes in method signatures.

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 19, 2016

rebased. I think some lines got moved around incorrectly. I am checking that. The end result does build, and the context that the commits provide to each other is all self-contained within this PR.

@nishanttotla
Copy link
Contributor

@MHBauer any updates on this? I think we should try to merge it before the final 1.2 release. engine-master tests are failing due to #2002, but can you check if the engine-1.10 failure is related or not?

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 22, 2016

I highly doubt it. I don't want to keep punching the build machine til it works. Integration-tests work locally. Can you reproduce the failure? I'll run them again here.

@nishanttotla
Copy link
Contributor

@MHBauer if they work locally then it's fine, I just wanted to be sure :)

@nishanttotla nishanttotla added this to the 1.2.0 milestone Mar 22, 2016
@nishanttotla
Copy link
Contributor

@MHBauer what's the status of this PR?

I'm slightly surprised that there are no merge conflicts, so can you make sure that everything's alright? :)

We'd like to merge this for 1.2.

@vieux
Copy link
Contributor

vieux commented Mar 29, 2016

@MHBauer please rebase :)

@vieux
Copy link
Contributor

vieux commented Mar 29, 2016

LGTM

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 29, 2016

Well, at least it's the same test failing. Rebased. Investigating integration test leader election - rescheduling. I am open to suggestions.

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 29, 2016

reproduces locally as well.

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 29, 2016

hmn, it's failing on master as well. Now I'm confused.

@vieux
Copy link
Contributor

vieux commented Mar 29, 2016

@MHBauer it's unrelated.

@nishanttotla let's merge

apiClient.On("NetworkList", mock.Anything,
mock.AnythingOfType("NetworkListOptions"),
).Return([]types.NetworkResource{}, nil)
apiClient.On("VolumeList", mock.Anything, mock.Anything).Return(types.VolumesListResponse{}, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

@MHBauer could you do something like mock.AnythingOfType("VolumeListOptions") to be consistent with the above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. VolumeList takes a generic filters.Args. NetworksList has a specific struct that it takes.

I can try mock.AnythingOfType("Args") but that might be less helpful than just being Anything. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather that we be as specific as possible. Especially since all types are changing, and just in case any stray arguments get passed it'd be nice to know (even though for this particular case I don't see that happening). It also helps with debugging in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

edited to be Args.

@nishanttotla
Copy link
Contributor

@MHBauer it looks good overall, just some minor fixes :)

 - remove unused argument
 - unit test of new client

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
 - create volume
 - list volumes

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
@dongluochen
Copy link
Contributor

LGTM

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 29, 2016

Same two flaky tests, nothing more, so I'll merge it.

@nishanttotla
Copy link
Contributor

LGTM. Test failures unrelated, as confirmed by @abronan.

@nishanttotla nishanttotla merged commit 2e9daed into docker-archive:master Mar 29, 2016
@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 29, 2016

Or you'll merge it. That's cool too.

@nishanttotla
Copy link
Contributor

@MHBauer 🎉

ChristianKniep pushed a commit to ChristianKniep/swarm that referenced this pull request Jul 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants