From b3f843afe29e3fbdc19c99f50ca6261878179d53 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 21 Aug 2017 16:30:09 -0400 Subject: [PATCH] Move internal/test package out of cli. Signed-off-by: Daniel Nephin --- cli/command/checkpoint/create_test.go | 2 +- cli/command/checkpoint/list_test.go | 2 +- cli/command/checkpoint/remove_test.go | 2 +- cli/command/config/create_test.go | 2 +- cli/command/config/inspect_test.go | 4 ++-- cli/command/config/ls_test.go | 4 ++-- cli/command/config/remove_test.go | 2 +- cli/command/container/attach_test.go | 2 +- cli/command/container/exec_test.go | 2 +- cli/command/idresolver/idresolver_test.go | 2 +- cli/command/image/build_test.go | 2 +- cli/command/image/history_test.go | 2 +- cli/command/image/import_test.go | 2 +- cli/command/image/inspect_test.go | 2 +- cli/command/image/list_test.go | 2 +- cli/command/image/load_test.go | 2 +- cli/command/image/prune_test.go | 2 +- cli/command/image/pull_test.go | 2 +- cli/command/image/push_test.go | 2 +- cli/command/image/remove_test.go | 2 +- cli/command/image/save_test.go | 2 +- cli/command/image/tag_test.go | 2 +- cli/command/network/connect_test.go | 2 +- cli/command/network/create_test.go | 2 +- cli/command/network/disconnect_test.go | 2 +- cli/command/node/demote_test.go | 4 ++-- cli/command/node/inspect_test.go | 4 ++-- cli/command/node/list_test.go | 4 ++-- cli/command/node/promote_test.go | 4 ++-- cli/command/node/ps_test.go | 4 ++-- cli/command/node/remove_test.go | 2 +- cli/command/node/update_test.go | 4 ++-- cli/command/registry_test.go | 4 ++-- cli/command/secret/create_test.go | 2 +- cli/command/secret/inspect_test.go | 4 ++-- cli/command/secret/ls_test.go | 4 ++-- cli/command/secret/remove_test.go | 2 +- cli/command/service/client_test.go | 2 +- cli/command/service/list_test.go | 2 +- cli/command/service/ps_test.go | 2 +- cli/command/service/rollback_test.go | 2 +- cli/command/stack/deploy_composefile_test.go | 2 +- cli/command/stack/deploy_test.go | 2 +- cli/command/stack/list_test.go | 4 ++-- cli/command/stack/ps_test.go | 4 ++-- cli/command/stack/remove_test.go | 2 +- cli/command/stack/services_test.go | 4 ++-- cli/command/swarm/ca_test.go | 2 +- cli/command/swarm/init_test.go | 2 +- cli/command/swarm/join_test.go | 2 +- cli/command/swarm/join_token_test.go | 4 ++-- cli/command/swarm/leave_test.go | 2 +- cli/command/swarm/unlock_key_test.go | 4 ++-- cli/command/swarm/unlock_test.go | 2 +- cli/command/swarm/update_test.go | 4 ++-- cli/command/system/prune_test.go | 2 +- cli/command/task/print_test.go | 4 ++-- cli/command/volume/create_test.go | 2 +- cli/command/volume/inspect_test.go | 4 ++-- cli/command/volume/list_test.go | 4 ++-- cli/command/volume/prune_test.go | 2 +- cli/command/volume/remove_test.go | 2 +- .../internal => internal}/test/builders/config.go | 0 {cli/internal => internal}/test/builders/doc.go | 0 {cli/internal => internal}/test/builders/node.go | 0 .../internal => internal}/test/builders/secret.go | 0 .../test/builders/service.go | 0 {cli/internal => internal}/test/builders/swarm.go | 0 {cli/internal => internal}/test/builders/task.go | 0 .../internal => internal}/test/builders/volume.go | 0 {cli/internal => internal}/test/cli.go | 0 {cli/internal => internal}/test/doc.go | 0 {cli/internal => internal}/test/network/client.go | 0 {cli/internal => internal}/test/store.go | 0 internal/test/testutil/assert.go | 15 +++++++++++++++ 75 files changed, 97 insertions(+), 82 deletions(-) rename {cli/internal => internal}/test/builders/config.go (100%) rename {cli/internal => internal}/test/builders/doc.go (100%) rename {cli/internal => internal}/test/builders/node.go (100%) rename {cli/internal => internal}/test/builders/secret.go (100%) rename {cli/internal => internal}/test/builders/service.go (100%) rename {cli/internal => internal}/test/builders/swarm.go (100%) rename {cli/internal => internal}/test/builders/task.go (100%) rename {cli/internal => internal}/test/builders/volume.go (100%) rename {cli/internal => internal}/test/cli.go (100%) rename {cli/internal => internal}/test/doc.go (100%) rename {cli/internal => internal}/test/network/client.go (100%) rename {cli/internal => internal}/test/store.go (100%) create mode 100644 internal/test/testutil/assert.go diff --git a/cli/command/checkpoint/create_test.go b/cli/command/checkpoint/create_test.go index 32c9d88a6f..8aae6eba5c 100644 --- a/cli/command/checkpoint/create_test.go +++ b/cli/command/checkpoint/create_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" diff --git a/cli/command/checkpoint/list_test.go b/cli/command/checkpoint/list_test.go index 26dd963a8c..dd934cd590 100644 --- a/cli/command/checkpoint/list_test.go +++ b/cli/command/checkpoint/list_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/checkpoint/remove_test.go b/cli/command/checkpoint/remove_test.go index 976aa07892..174a389eef 100644 --- a/cli/command/checkpoint/remove_test.go +++ b/cli/command/checkpoint/remove_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" diff --git a/cli/command/config/create_test.go b/cli/command/config/create_test.go index 7a6b2f54d3..a5bdce2dad 100644 --- a/cli/command/config/create_test.go +++ b/cli/command/config/create_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/config/inspect_test.go b/cli/command/config/inspect_test.go index 0431ffd652..320df70aaf 100644 --- a/cli/command/config/inspect_test.go +++ b/cli/command/config/inspect_test.go @@ -6,11 +6,11 @@ import ( "testing" "time" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/config/ls_test.go b/cli/command/config/ls_test.go index f58e815a5b..dfe79dc3c4 100644 --- a/cli/command/config/ls_test.go +++ b/cli/command/config/ls_test.go @@ -6,12 +6,12 @@ import ( "time" "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/config/remove_test.go b/cli/command/config/remove_test.go index 28cc41f670..2b7245167e 100644 --- a/cli/command/config/remove_test.go +++ b/cli/command/config/remove_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" "github.com/stretchr/testify/assert" diff --git a/cli/command/container/attach_test.go b/cli/command/container/attach_test.go index a33eeeeb54..e4caa473af 100644 --- a/cli/command/container/attach_test.go +++ b/cli/command/container/attach_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" diff --git a/cli/command/container/exec_test.go b/cli/command/container/exec_test.go index 0eed2ff0f7..acfe250d3b 100644 --- a/cli/command/container/exec_test.go +++ b/cli/command/container/exec_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" diff --git a/cli/command/idresolver/idresolver_test.go b/cli/command/idresolver/idresolver_test.go index f740c13eff..98bd306d16 100644 --- a/cli/command/idresolver/idresolver_test.go +++ b/cli/command/idresolver/idresolver_test.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/api/types/swarm" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "golang.org/x/net/context" diff --git a/cli/command/image/build_test.go b/cli/command/image/build_test.go index 3664b91b7c..325c82343e 100644 --- a/cli/command/image/build_test.go +++ b/cli/command/image/build_test.go @@ -10,7 +10,7 @@ import ( "testing" "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/archive" "github.com/stretchr/testify/assert" diff --git a/cli/command/image/history_test.go b/cli/command/image/history_test.go index 7053735aa3..c0a7ef3139 100644 --- a/cli/command/image/history_test.go +++ b/cli/command/image/history_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/image" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/image/import_test.go b/cli/command/image/import_test.go index 87cc89693c..0e45e7887f 100644 --- a/cli/command/image/import_test.go +++ b/cli/command/image/import_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" diff --git a/cli/command/image/inspect_test.go b/cli/command/image/inspect_test.go index 0bcb65836c..d1de685610 100644 --- a/cli/command/image/inspect_test.go +++ b/cli/command/image/inspect_test.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/image/list_test.go b/cli/command/image/list_test.go index 58b7a71bdb..9be4c379bc 100644 --- a/cli/command/image/list_test.go +++ b/cli/command/image/list_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/image/load_test.go b/cli/command/image/load_test.go index bebe40cb07..d3002aa1cd 100644 --- a/cli/command/image/load_test.go +++ b/cli/command/image/load_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/image/prune_test.go b/cli/command/image/prune_test.go index b52601608f..90845e4bb4 100644 --- a/cli/command/image/prune_test.go +++ b/cli/command/image/prune_test.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/image/pull_test.go b/cli/command/image/pull_test.go index 7b24cdbb08..57cd0ac772 100644 --- a/cli/command/image/pull_test.go +++ b/cli/command/image/pull_test.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/image/push_test.go b/cli/command/image/push_test.go index 1ead5b1549..8f8b35d292 100644 --- a/cli/command/image/push_test.go +++ b/cli/command/image/push_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" diff --git a/cli/command/image/remove_test.go b/cli/command/image/remove_test.go index a813f8f107..7bf0434d6e 100644 --- a/cli/command/image/remove_test.go +++ b/cli/command/image/remove_test.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/image/save_test.go b/cli/command/image/save_test.go index 424c2c9a42..9e3ff147ab 100644 --- a/cli/command/image/save_test.go +++ b/cli/command/image/save_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" "github.com/stretchr/testify/assert" diff --git a/cli/command/image/tag_test.go b/cli/command/image/tag_test.go index c86bd22b36..bb0c71cae5 100644 --- a/cli/command/image/tag_test.go +++ b/cli/command/image/tag_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/stretchr/testify/assert" ) diff --git a/cli/command/network/connect_test.go b/cli/command/network/connect_test.go index 577dd8c25a..2343c7efbb 100644 --- a/cli/command/network/connect_test.go +++ b/cli/command/network/connect_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/network" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" diff --git a/cli/command/network/create_test.go b/cli/command/network/create_test.go index 76c760d0ad..b06febb4ea 100644 --- a/cli/command/network/create_test.go +++ b/cli/command/network/create_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/network/disconnect_test.go b/cli/command/network/disconnect_test.go index 9b915a19b5..04a5ab4378 100644 --- a/cli/command/network/disconnect_test.go +++ b/cli/command/network/disconnect_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" "golang.org/x/net/context" diff --git a/cli/command/node/demote_test.go b/cli/command/node/demote_test.go index d786cd47a2..ccdbb59904 100644 --- a/cli/command/node/demote_test.go +++ b/cli/command/node/demote_test.go @@ -4,11 +4,11 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/stretchr/testify/assert" ) diff --git a/cli/command/node/inspect_test.go b/cli/command/node/inspect_test.go index b841b0639d..1ce6ebd441 100644 --- a/cli/command/node/inspect_test.go +++ b/cli/command/node/inspect_test.go @@ -5,12 +5,12 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/node/list_test.go b/cli/command/node/list_test.go index fee29e284b..b3a42df460 100644 --- a/cli/command/node/list_test.go +++ b/cli/command/node/list_test.go @@ -5,13 +5,13 @@ import ( "testing" "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/stretchr/testify/assert" ) diff --git a/cli/command/node/promote_test.go b/cli/command/node/promote_test.go index 2399b2ee8c..e0e228e860 100644 --- a/cli/command/node/promote_test.go +++ b/cli/command/node/promote_test.go @@ -4,11 +4,11 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/stretchr/testify/assert" ) diff --git a/cli/command/node/ps_test.go b/cli/command/node/ps_test.go index 8733e5e0f4..836a130f76 100644 --- a/cli/command/node/ps_test.go +++ b/cli/command/node/ps_test.go @@ -6,12 +6,12 @@ import ( "testing" "time" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" ) diff --git a/cli/command/node/remove_test.go b/cli/command/node/remove_test.go index e0f3f238e6..84d09c70e2 100644 --- a/cli/command/node/remove_test.go +++ b/cli/command/node/remove_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" "github.com/stretchr/testify/assert" diff --git a/cli/command/node/update_test.go b/cli/command/node/update_test.go index 3abb720c1c..4544cd12cb 100644 --- a/cli/command/node/update_test.go +++ b/cli/command/node/update_test.go @@ -4,11 +4,11 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/stretchr/testify/assert" ) diff --git a/cli/command/registry_test.go b/cli/command/registry_test.go index 5e52e470a1..3f3d5f579f 100644 --- a/cli/command/registry_test.go +++ b/cli/command/registry_test.go @@ -7,9 +7,9 @@ import ( "github.com/stretchr/testify/assert" "golang.org/x/net/context" - // Prevents a circular import with "github.com/docker/cli/cli/internal/test" + // Prevents a circular import with "github.com/docker/cli/internal/test" . "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/client" ) diff --git a/cli/command/secret/create_test.go b/cli/command/secret/create_test.go index 0887601ab6..cc9eaa1067 100644 --- a/cli/command/secret/create_test.go +++ b/cli/command/secret/create_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/secret/inspect_test.go b/cli/command/secret/inspect_test.go index eef789d80b..4a38a18f5d 100644 --- a/cli/command/secret/inspect_test.go +++ b/cli/command/secret/inspect_test.go @@ -6,11 +6,11 @@ import ( "testing" "time" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/secret/ls_test.go b/cli/command/secret/ls_test.go index cced136106..af72effe94 100644 --- a/cli/command/secret/ls_test.go +++ b/cli/command/secret/ls_test.go @@ -7,12 +7,12 @@ import ( "time" "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/secret/remove_test.go b/cli/command/secret/remove_test.go index f3e427f7d7..51622136ab 100644 --- a/cli/command/secret/remove_test.go +++ b/cli/command/secret/remove_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" "github.com/stretchr/testify/assert" diff --git a/cli/command/service/client_test.go b/cli/command/service/client_test.go index a886ff6a6d..ebdfe7ea74 100644 --- a/cli/command/service/client_test.go +++ b/cli/command/service/client_test.go @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/client" "golang.org/x/net/context" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" ) type fakeClient struct { diff --git a/cli/command/service/list_test.go b/cli/command/service/list_test.go index 297f5f9b17..679c733701 100644 --- a/cli/command/service/list_test.go +++ b/cli/command/service/list_test.go @@ -3,7 +3,7 @@ package service import ( "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/service/ps_test.go b/cli/command/service/ps_test.go index 083c58f91f..1913202d33 100644 --- a/cli/command/service/ps_test.go +++ b/cli/command/service/ps_test.go @@ -3,7 +3,7 @@ package service import ( "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/cli/opts" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" diff --git a/cli/command/service/rollback_test.go b/cli/command/service/rollback_test.go index 48be5076d7..f4183dae23 100644 --- a/cli/command/service/rollback_test.go +++ b/cli/command/service/rollback_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/stack/deploy_composefile_test.go b/cli/command/stack/deploy_composefile_test.go index 8d09ab056c..28edb2c137 100644 --- a/cli/command/stack/deploy_composefile_test.go +++ b/cli/command/stack/deploy_composefile_test.go @@ -5,7 +5,7 @@ import ( "path/filepath" "testing" - "github.com/docker/cli/cli/internal/test/network" + "github.com/docker/cli/internal/test/network" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/fs" diff --git a/cli/command/stack/deploy_test.go b/cli/command/stack/deploy_test.go index f91a825f9b..f10fecd1af 100644 --- a/cli/command/stack/deploy_test.go +++ b/cli/command/stack/deploy_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/docker/cli/cli/compose/convert" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/stretchr/testify/assert" diff --git a/cli/command/stack/list_test.go b/cli/command/stack/list_test.go index 0ae5bc78ce..f194d04fcd 100644 --- a/cli/command/stack/list_test.go +++ b/cli/command/stack/list_test.go @@ -4,9 +4,9 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/stack/ps_test.go b/cli/command/stack/ps_test.go index 249e1b656a..b98c445f28 100644 --- a/cli/command/stack/ps_test.go +++ b/cli/command/stack/ps_test.go @@ -6,9 +6,9 @@ import ( "time" "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/stack/remove_test.go b/cli/command/stack/remove_test.go index 88ad8a07d3..c44977c0c6 100644 --- a/cli/command/stack/remove_test.go +++ b/cli/command/stack/remove_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/stretchr/testify/assert" ) diff --git a/cli/command/stack/services_test.go b/cli/command/stack/services_test.go index fcc82ec885..d1d6c24081 100644 --- a/cli/command/stack/services_test.go +++ b/cli/command/stack/services_test.go @@ -5,9 +5,9 @@ import ( "testing" "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/swarm/ca_test.go b/cli/command/swarm/ca_test.go index a1a77d59c2..1271da1270 100644 --- a/cli/command/swarm/ca_test.go +++ b/cli/command/swarm/ca_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" "github.com/stretchr/testify/assert" diff --git a/cli/command/swarm/init_test.go b/cli/command/swarm/init_test.go index 5991c3dd54..24a1b90717 100644 --- a/cli/command/swarm/init_test.go +++ b/cli/command/swarm/init_test.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/swarm/join_test.go b/cli/command/swarm/join_test.go index d9f5215b7b..ed8eff8571 100644 --- a/cli/command/swarm/join_test.go +++ b/cli/command/swarm/join_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/swarm/join_token_test.go b/cli/command/swarm/join_token_test.go index da1b795321..89f7ab22b9 100644 --- a/cli/command/swarm/join_token_test.go +++ b/cli/command/swarm/join_token_test.go @@ -5,12 +5,12 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/swarm/leave_test.go b/cli/command/swarm/leave_test.go index b5b672fe47..d2f5d57bbb 100644 --- a/cli/command/swarm/leave_test.go +++ b/cli/command/swarm/leave_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" "github.com/stretchr/testify/assert" diff --git a/cli/command/swarm/unlock_key_test.go b/cli/command/swarm/unlock_key_test.go index 0dc9fb5f08..e377e80c7b 100644 --- a/cli/command/swarm/unlock_key_test.go +++ b/cli/command/swarm/unlock_key_test.go @@ -5,12 +5,12 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/swarm/unlock_test.go b/cli/command/swarm/unlock_test.go index 6663df1dba..5151d6ba5e 100644 --- a/cli/command/swarm/unlock_test.go +++ b/cli/command/swarm/unlock_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/swarm/update_test.go b/cli/command/swarm/update_test.go index 3c928a2e0d..e1cd8d7c4d 100644 --- a/cli/command/swarm/update_test.go +++ b/cli/command/swarm/update_test.go @@ -6,12 +6,12 @@ import ( "testing" "time" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/system/prune_test.go b/cli/command/system/prune_test.go index 669166c998..0d694ce066 100644 --- a/cli/command/system/prune_test.go +++ b/cli/command/system/prune_test.go @@ -3,7 +3,7 @@ package system import ( "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/stretchr/testify/assert" ) diff --git a/cli/command/task/print_test.go b/cli/command/task/print_test.go index 19e02c6d18..04ae1bb0ef 100644 --- a/cli/command/task/print_test.go +++ b/cli/command/task/print_test.go @@ -6,10 +6,10 @@ import ( "github.com/docker/cli/cli/command/formatter" "github.com/docker/cli/cli/command/idresolver" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "golang.org/x/net/context" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/golden" diff --git a/cli/command/volume/create_test.go b/cli/command/volume/create_test.go index cf84195f45..de534053b1 100644 --- a/cli/command/volume/create_test.go +++ b/cli/command/volume/create_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" volumetypes "github.com/docker/docker/api/types/volume" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/volume/inspect_test.go b/cli/command/volume/inspect_test.go index fccccf4442..57949305e5 100644 --- a/cli/command/volume/inspect_test.go +++ b/cli/command/volume/inspect_test.go @@ -5,11 +5,11 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/volume/list_test.go b/cli/command/volume/list_test.go index 0eab71dc45..5f5654d5af 100644 --- a/cli/command/volume/list_test.go +++ b/cli/command/volume/list_test.go @@ -5,13 +5,13 @@ import ( "testing" "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" volumetypes "github.com/docker/docker/api/types/volume" "github.com/pkg/errors" // Import builders to get the builder function as package function - . "github.com/docker/cli/cli/internal/test/builders" + . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil" "github.com/gotestyourself/gotestyourself/golden" "github.com/stretchr/testify/assert" diff --git a/cli/command/volume/prune_test.go b/cli/command/volume/prune_test.go index ccb5b15e39..788c02b342 100644 --- a/cli/command/volume/prune_test.go +++ b/cli/command/volume/prune_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/pkg/testutil" diff --git a/cli/command/volume/remove_test.go b/cli/command/volume/remove_test.go index c10b18cc47..348714f4fe 100644 --- a/cli/command/volume/remove_test.go +++ b/cli/command/volume/remove_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/docker/cli/cli/internal/test" + "github.com/docker/cli/internal/test" "github.com/docker/docker/pkg/testutil" "github.com/pkg/errors" "github.com/stretchr/testify/assert" diff --git a/cli/internal/test/builders/config.go b/internal/test/builders/config.go similarity index 100% rename from cli/internal/test/builders/config.go rename to internal/test/builders/config.go diff --git a/cli/internal/test/builders/doc.go b/internal/test/builders/doc.go similarity index 100% rename from cli/internal/test/builders/doc.go rename to internal/test/builders/doc.go diff --git a/cli/internal/test/builders/node.go b/internal/test/builders/node.go similarity index 100% rename from cli/internal/test/builders/node.go rename to internal/test/builders/node.go diff --git a/cli/internal/test/builders/secret.go b/internal/test/builders/secret.go similarity index 100% rename from cli/internal/test/builders/secret.go rename to internal/test/builders/secret.go diff --git a/cli/internal/test/builders/service.go b/internal/test/builders/service.go similarity index 100% rename from cli/internal/test/builders/service.go rename to internal/test/builders/service.go diff --git a/cli/internal/test/builders/swarm.go b/internal/test/builders/swarm.go similarity index 100% rename from cli/internal/test/builders/swarm.go rename to internal/test/builders/swarm.go diff --git a/cli/internal/test/builders/task.go b/internal/test/builders/task.go similarity index 100% rename from cli/internal/test/builders/task.go rename to internal/test/builders/task.go diff --git a/cli/internal/test/builders/volume.go b/internal/test/builders/volume.go similarity index 100% rename from cli/internal/test/builders/volume.go rename to internal/test/builders/volume.go diff --git a/cli/internal/test/cli.go b/internal/test/cli.go similarity index 100% rename from cli/internal/test/cli.go rename to internal/test/cli.go diff --git a/cli/internal/test/doc.go b/internal/test/doc.go similarity index 100% rename from cli/internal/test/doc.go rename to internal/test/doc.go diff --git a/cli/internal/test/network/client.go b/internal/test/network/client.go similarity index 100% rename from cli/internal/test/network/client.go rename to internal/test/network/client.go diff --git a/cli/internal/test/store.go b/internal/test/store.go similarity index 100% rename from cli/internal/test/store.go rename to internal/test/store.go diff --git a/internal/test/testutil/assert.go b/internal/test/testutil/assert.go new file mode 100644 index 0000000000..cf5d2c9876 --- /dev/null +++ b/internal/test/testutil/assert.go @@ -0,0 +1,15 @@ +package testutil + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// ErrorContains checks that the error is not nil, and contains the expected +// substring. +// TODO: replace with testify if https://github.com/stretchr/testify/pull/486 +// is accepted. +func ErrorContains(t require.TestingT, err error, expectedError string) { + require.Error(t, err) + assert.Contains(t, err.Error(), expectedError) +}