diff --git a/cli/command/cli_test.go b/cli/command/cli_test.go index 5474d3e561..9a51a3fbcd 100644 --- a/cli/command/cli_test.go +++ b/cli/command/cli_test.go @@ -9,7 +9,6 @@ import ( "net" "net/http" "net/http/httptest" - "os" "path/filepath" "runtime" "strings" @@ -19,7 +18,6 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/flags" - "github.com/docker/cli/cli/streams" "github.com/docker/docker/api" "github.com/docker/docker/api/types" "github.com/docker/docker/client" @@ -256,46 +254,6 @@ func TestInitializeFromClientHangs(t *testing.T) { } } -// The CLI no longer disables/hides experimental CLI features, however, we need -// to verify that existing configuration files do not break -func TestExperimentalCLI(t *testing.T) { - defaultVersion := "v1.55" - - testcases := []struct { - doc string - configfile string - }{ - { - doc: "default", - configfile: `{}`, - }, - { - doc: "experimental", - configfile: `{ - "experimental": "enabled" -}`, - }, - } - - for _, tc := range testcases { - t.Run(tc.doc, func(t *testing.T) { - dir := fs.NewDir(t, tc.doc, fs.WithFile("config.json", tc.configfile)) - defer dir.Remove() - apiclient := &fakeClient{ - version: defaultVersion, - pingFunc: func() (types.Ping, error) { - return types.Ping{Experimental: true, OSType: "linux", APIVersion: defaultVersion}, nil - }, - } - - cli := &DockerCli{client: apiclient, err: streams.NewOut(os.Stderr)} - config.SetDir(dir.Path()) - err := cli.Initialize(flags.NewClientOptions()) - assert.NilError(t, err) - }) - } -} - func TestNewDockerCliAndOperators(t *testing.T) { // Test default operations and also overriding default ones cli, err := NewDockerCli(WithInputStream(io.NopCloser(strings.NewReader("some input")))) diff --git a/cli/config/config_test.go b/cli/config/config_test.go index 0d0edfa1e1..922641a726 100644 --- a/cli/config/config_test.go +++ b/cli/config/config_test.go @@ -398,6 +398,32 @@ func TestLoadDefaultConfigFile(t *testing.T) { }) } +// The CLI no longer disables/hides experimental CLI features, however, we need +// to verify that existing configuration files do not break +func TestLoadLegacyExperimental(t *testing.T) { + tests := []struct { + doc string + configfile string + }{ + { + doc: "default", + configfile: `{}`, + }, + { + doc: "experimental", + configfile: `{ + "experimental": "enabled" +}`, + }, + } + for _, tc := range tests { + t.Run(tc.doc, func(t *testing.T) { + _, err := LoadFromReader(strings.NewReader(tc.configfile)) + assert.NilError(t, err) + }) + } +} + func TestConfigPath(t *testing.T) { oldDir := Dir()