mirror of
https://github.com/docker/compose.git
synced 2026-08-31 23:03:55 +00:00
When can not load config file, the previous cli is displaying a WARNING message, but continues with default context, we should do the same.
This happened in some desktop e2e tests where the config file is not set properly in WSL2 environment, see https://github.com/docker/pinata/pull/14062
This commit is contained in:
parent
bc1b2b778a
commit
98f7a8e1aa
2 changed files with 9 additions and 15 deletions
|
|
@ -56,23 +56,19 @@ func TestDetermineCurrentContext(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// If nothing set, fallback to default
|
||||
c, err := determineCurrentContext("", "")
|
||||
require.NoError(t, err)
|
||||
c := determineCurrentContext("", "")
|
||||
require.Equal(t, "default", c)
|
||||
|
||||
// If context flag set, use that
|
||||
c, err = determineCurrentContext("other-context", "")
|
||||
require.NoError(t, err)
|
||||
c = determineCurrentContext("other-context", "")
|
||||
require.Equal(t, "other-context", c)
|
||||
|
||||
// If no context flag, use config
|
||||
c, err = determineCurrentContext("", d)
|
||||
require.NoError(t, err)
|
||||
c = determineCurrentContext("", d)
|
||||
require.Equal(t, "some-context", c)
|
||||
|
||||
// Ensure context flag overrides config
|
||||
c, err = determineCurrentContext("other-context", d)
|
||||
require.NoError(t, err)
|
||||
c = determineCurrentContext("other-context", d)
|
||||
require.Equal(t, "other-context", c)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue