mirror of https://github.com/docker/cli.git
Replace pkg/testutil/tempfile with gotestyourself/fs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
505a0fe45f
commit
15837afa77
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/docker/cli/cli/internal/test/network"
|
"github.com/docker/cli/cli/internal/test/network"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/pkg/testutil"
|
"github.com/docker/docker/pkg/testutil"
|
||||||
"github.com/docker/docker/pkg/testutil/tempfile"
|
"github.com/gotestyourself/gotestyourself/fs"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -22,12 +22,12 @@ services:
|
||||||
foo:
|
foo:
|
||||||
image: alpine:3.5
|
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()
|
defer file.Remove()
|
||||||
|
|
||||||
details, err := getConfigDetails(file.Name())
|
details, err := getConfigDetails(file.Path())
|
||||||
require.NoError(t, err)
|
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.ConfigFiles, 1)
|
||||||
assert.Len(t, details.Environment, len(os.Environ()))
|
assert.Len(t, details.Environment, len(os.Environ()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
composetypes "github.com/docker/cli/cli/compose/types"
|
composetypes "github.com/docker/cli/cli/compose/types"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/network"
|
"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/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -107,12 +107,12 @@ func TestSecrets(t *testing.T) {
|
||||||
namespace := Namespace{name: "foo"}
|
namespace := Namespace{name: "foo"}
|
||||||
|
|
||||||
secretText := "this is the first secret"
|
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()
|
defer secretFile.Remove()
|
||||||
|
|
||||||
source := map[string]composetypes.SecretConfig{
|
source := map[string]composetypes.SecretConfig{
|
||||||
"one": {
|
"one": {
|
||||||
File: secretFile.Name(),
|
File: secretFile.Path(),
|
||||||
Labels: map[string]string{"monster": "mash"},
|
Labels: map[string]string{"monster": "mash"},
|
||||||
},
|
},
|
||||||
"ext": {
|
"ext": {
|
||||||
|
@ -138,12 +138,12 @@ func TestConfigs(t *testing.T) {
|
||||||
namespace := Namespace{name: "foo"}
|
namespace := Namespace{name: "foo"}
|
||||||
|
|
||||||
configText := "this is the first config"
|
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()
|
defer configFile.Remove()
|
||||||
|
|
||||||
source := map[string]composetypes.ConfigObjConfig{
|
source := map[string]composetypes.ConfigObjConfig{
|
||||||
"one": {
|
"one": {
|
||||||
File: configFile.Name(),
|
File: configFile.Path(),
|
||||||
Labels: map[string]string{"monster": "mash"},
|
Labels: map[string]string{"monster": "mash"},
|
||||||
},
|
},
|
||||||
"ext": {
|
"ext": {
|
||||||
|
|
Loading…
Reference in New Issue