mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: remove transport package
This package doesn't really seem to do anything of real interest. Removing it and replacing with a few helper functions. Most of this was maintaining a fork of ctxhttp to support a mock that was unnecessary. We could probably do with a further refactor of the client interface. There is a lot of confusion of between transport, http layer and application layer that makes for some awkward code. This change improves the situation to the point where no breaking changes are introduced. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
func TestContainerRestartError(t *testing.T) {
|
||||
client := &Client{
|
||||
transport: newMockClient(nil, errorMock(http.StatusInternalServerError, "Server error")),
|
||||
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
|
||||
}
|
||||
timeout := 0 * time.Second
|
||||
err := client.ContainerRestart(context.Background(), "nothing", &timeout)
|
||||
@@ -26,7 +26,7 @@ func TestContainerRestartError(t *testing.T) {
|
||||
func TestContainerRestart(t *testing.T) {
|
||||
expectedURL := "/containers/container_id/restart"
|
||||
client := &Client{
|
||||
transport: newMockClient(nil, func(req *http.Request) (*http.Response, error) {
|
||||
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
||||
if !strings.HasPrefix(req.URL.Path, expectedURL) {
|
||||
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user