diff options
author | Tõnis Tiigi <tonistiigi@gmail.com> | 2018-02-16 10:18:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-16 10:18:47 -0800 |
commit | db360995df97f9d9bcb4eb6a34a5c35a2711795b (patch) | |
tree | 04019ecfcce62e8e70853e9bd5e59a1b0c86e70a /client/network_inspect_test.go | |
parent | 302e584b78db16ea39aca7d7c1612370c50d20f5 (diff) | |
parent | 3e6bbefd268f51755be5af0644995297a71a05d7 (diff) | |
download | docker-db360995df97f9d9bcb4eb6a34a5c35a2711795b.tar.gz |
Merge pull request #36144 from emil2k/node-id-required
Produce errors when empty ids are passed into inspect calls.
Diffstat (limited to 'client/network_inspect_test.go')
-rw-r--r-- | client/network_inspect_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/network_inspect_test.go b/client/network_inspect_test.go index 95fcb0d646..7031611911 100644 --- a/client/network_inspect_test.go +++ b/client/network_inspect_test.go @@ -11,6 +11,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" + "github.com/pkg/errors" "github.com/stretchr/testify/assert" "golang.org/x/net/context" ) @@ -34,6 +35,18 @@ func TestNetworkInspectNotFoundError(t *testing.T) { assert.True(t, IsErrNotFound(err)) } +func TestNetworkInspectWithEmptyID(t *testing.T) { + client := &Client{ + client: newMockClient(func(req *http.Request) (*http.Response, error) { + return nil, errors.New("should not make request") + }), + } + _, _, err := client.NetworkInspectWithRaw(context.Background(), "", types.NetworkInspectOptions{}) + if !IsErrNotFound(err) { + t.Fatalf("Expected NotFoundError, got %v", err) + } +} + func TestNetworkInspect(t *testing.T) { expectedURL := "/networks/network_id" client := &Client{ |