|
@@ -11,6 +11,7 @@ import (
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/internal/testutil"
|
|
"github.com/docker/docker/internal/testutil"
|
|
|
|
+ "github.com/pkg/errors"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/stretchr/testify/require"
|
|
"golang.org/x/net/context"
|
|
"golang.org/x/net/context"
|
|
@@ -35,20 +36,15 @@ func TestVolumeInspectNotFound(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestVolumeInspectWithEmptyID(t *testing.T) {
|
|
func TestVolumeInspectWithEmptyID(t *testing.T) {
|
|
- expectedURL := "/volumes/"
|
|
|
|
-
|
|
|
|
client := &Client{
|
|
client := &Client{
|
|
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
|
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
|
- assert.Equal(t, req.URL.Path, expectedURL)
|
|
|
|
- return &http.Response{
|
|
|
|
- StatusCode: http.StatusNotFound,
|
|
|
|
- Body: ioutil.NopCloser(bytes.NewReader(nil)),
|
|
|
|
- }, nil
|
|
|
|
|
|
+ return nil, errors.New("should not make request")
|
|
}),
|
|
}),
|
|
}
|
|
}
|
|
- _, err := client.VolumeInspect(context.Background(), "")
|
|
|
|
- testutil.ErrorContains(t, err, "No such volume: ")
|
|
|
|
-
|
|
|
|
|
|
+ _, _, err := client.VolumeInspectWithRaw(context.Background(), "")
|
|
|
|
+ if !IsErrNotFound(err) {
|
|
|
|
+ t.Fatalf("Expected NotFoundError, got %v", err)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
func TestVolumeInspect(t *testing.T) {
|
|
func TestVolumeInspect(t *testing.T) {
|