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>
This commit is contained in:
Sebastiaan van Stijn 2025-04-02 14:08:01 +02:00
parent 6523832c73
commit f66c5a33d0
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -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)