Skip to content

Commit f66c5a3

Browse files
committed
cli/command: TestHooksEnabled: fix test when config file is present
This test verifies the default behavior, but when running the test in an environment that already has a ~/.docker/config.json present, it may fail. This patch updates the test to configure the config-directory to point to an empty directory, making sure it's not affected by state. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 6523832 commit f66c5a3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

cli/command/cli_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ func TestInitializeShouldAlwaysCreateTheContextStore(t *testing.T) {
302302

303303
func TestHooksEnabled(t *testing.T) {
304304
t.Run("disabled by default", func(t *testing.T) {
305+
// Make sure we don't depend on any existing ~/.docker/config.json
306+
config.SetDir(t.TempDir())
305307
cli, err := NewDockerCli()
306308
assert.NilError(t, err)
307309

0 commit comments

Comments
 (0)