mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: deprecate NewClientWithOpts in favor of New
Use a more idiomatic name so that it can be used as `client.New()`. We should look if we want `New()` to have different / updated defaults i.e., enable `WithEnv` as default, and have an opt-out and have API- version negotiation enabled by default (with an opt-out option). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestImageRemoveError(t *testing.T) {
|
||||
client, err := NewClientWithOpts(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))
|
||||
client, err := New(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.ImageRemove(context.Background(), "image_id", ImageRemoveOptions{})
|
||||
@@ -22,7 +22,7 @@ func TestImageRemoveError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImageRemoveImageNotFound(t *testing.T) {
|
||||
client, err := NewClientWithOpts(WithMockClient(errorMock(http.StatusNotFound, "no such image: unknown")))
|
||||
client, err := New(WithMockClient(errorMock(http.StatusNotFound, "no such image: unknown")))
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.ImageRemove(context.Background(), "unknown", ImageRemoveOptions{})
|
||||
@@ -65,7 +65,7 @@ func TestImageRemove(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, removeCase := range removeCases {
|
||||
client, err := NewClientWithOpts(WithMockClient(func(req *http.Request) (*http.Response, error) {
|
||||
client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) {
|
||||
if err := assertRequest(req, http.MethodDelete, expectedURL); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user