Skip to content

Commit

Permalink
chore: verify that Docker's default config file exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Mar 7, 2023
1 parent 6422834 commit 402471b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docker_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"path/filepath"
"testing"

"github.com/cpuguy83/dockercfg"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/stretchr/testify/assert"
Expand All @@ -24,6 +25,12 @@ var indexDockerIO = testcontainersdocker.IndexDockerIO
func TestGetDockerConfig(t *testing.T) {
const expectedErrorMessage = "Expected to find %s in auth configs"

// Verify that the default docker config file exists before any test in this suite runs.
// Then, we can safely run the tests that rely on it.
cfg, err := dockercfg.LoadDefaultConfig()
require.Nil(t, err)
require.NotNil(t, cfg)

t.Run("without DOCKER_CONFIG env var retrieves default", func(t *testing.T) {
cfg, err := getDockerConfig()
require.Nil(t, err)
Expand Down

0 comments on commit 402471b

Please sign in to comment.