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": {