From f66c5a33d0b3d5f8f5ffde1078e8c19b80343648 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 2 Apr 2025 14:08:01 +0200 Subject: [PATCH] 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 --- cli/command/cli_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/command/cli_test.go b/cli/command/cli_test.go index 9a51a3fbcd..553bbbf3f6 100644 --- a/cli/command/cli_test.go +++ b/cli/command/cli_test.go @@ -302,6 +302,8 @@ func TestInitializeShouldAlwaysCreateTheContextStore(t *testing.T) { func TestHooksEnabled(t *testing.T) { t.Run("disabled by default", func(t *testing.T) { + // Make sure we don't depend on any existing ~/.docker/config.json + config.SetDir(t.TempDir()) cli, err := NewDockerCli() assert.NilError(t, err)