From 15837afa777c61dbdcbea4c9e32251b43f647a72 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 16 Aug 2017 14:07:49 -0400 Subject: [PATCH] Replace pkg/testutil/tempfile with gotestyourself/fs Signed-off-by: Daniel Nephin --- cli/command/stack/deploy_composefile_test.go | 8 ++++---- cli/compose/convert/compose_test.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/command/stack/deploy_composefile_test.go b/cli/command/stack/deploy_composefile_test.go index 5d59ff7028..8d09ab056c 100644 --- a/cli/command/stack/deploy_composefile_test.go +++ b/cli/command/stack/deploy_composefile_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/cli/cli/internal/test/network" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/testutil" - "github.com/docker/docker/pkg/testutil/tempfile" + "github.com/gotestyourself/gotestyourself/fs" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -22,12 +22,12 @@ services: foo: image: alpine:3.5 ` - file := tempfile.NewTempFile(t, "test-get-config-details", content) + file := fs.NewFile(t, "test-get-config-details", fs.WithContent(content)) defer file.Remove() - details, err := getConfigDetails(file.Name()) + details, err := getConfigDetails(file.Path()) require.NoError(t, err) - assert.Equal(t, filepath.Dir(file.Name()), details.WorkingDir) + assert.Equal(t, filepath.Dir(file.Path()), details.WorkingDir) assert.Len(t, details.ConfigFiles, 1) assert.Len(t, details.Environment, len(os.Environ())) } diff --git a/cli/compose/convert/compose_test.go b/cli/compose/convert/compose_test.go index 57849dd9bc..bde0942069 100644 --- a/cli/compose/convert/compose_test.go +++ b/cli/compose/convert/compose_test.go @@ -6,7 +6,7 @@ import ( composetypes "github.com/docker/cli/cli/compose/types" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" - "github.com/docker/docker/pkg/testutil/tempfile" + "github.com/gotestyourself/gotestyourself/fs" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -107,12 +107,12 @@ func TestSecrets(t *testing.T) { namespace := Namespace{name: "foo"} secretText := "this is the first secret" - secretFile := tempfile.NewTempFile(t, "convert-secrets", secretText) + secretFile := fs.NewFile(t, "convert-secrets", fs.WithContent(secretText)) defer secretFile.Remove() source := map[string]composetypes.SecretConfig{ "one": { - File: secretFile.Name(), + File: secretFile.Path(), Labels: map[string]string{"monster": "mash"}, }, "ext": { @@ -138,12 +138,12 @@ func TestConfigs(t *testing.T) { namespace := Namespace{name: "foo"} configText := "this is the first config" - configFile := tempfile.NewTempFile(t, "convert-configs", configText) + configFile := fs.NewFile(t, "convert-configs", fs.WithContent(configText)) defer configFile.Remove() source := map[string]composetypes.ConfigObjConfig{ "one": { - File: configFile.Name(), + File: configFile.Path(), Labels: map[string]string{"monster": "mash"}, }, "ext": {