Skip to content

Commit a9beea4

Browse files
committed
Update Docker CLI interoperability test to match v29.0.0
Some of the string constants moved to internal subpackages, so just hard-code the values; that allows removing various packages from the (test-only) dependency tree. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
1 parent 7c8ce7f commit a9beea4

File tree

260 files changed

+13
-47357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+13
-47357
lines changed

image/go.mod

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ require (
1414
github.com/distribution/reference v0.6.0
1515
github.com/docker/cli v28.5.2+incompatible
1616
github.com/docker/distribution v2.8.3+incompatible
17-
github.com/docker/docker v28.5.2+incompatible
1817
github.com/docker/docker-credential-helpers v0.9.4
1918
github.com/docker/go-connections v0.6.0
2019
github.com/hashicorp/go-cleanhttp v0.5.2
@@ -50,21 +49,16 @@ require (
5049
github.com/Microsoft/go-winio v0.6.2 // indirect
5150
github.com/VividCortex/ewma v1.2.0 // indirect
5251
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
53-
github.com/beorn7/perks v1.0.1 // indirect
54-
github.com/cespare/xxhash/v2 v2.3.0 // indirect
5552
github.com/chzyer/readline v1.5.1 // indirect
5653
github.com/clipperhouse/stringish v0.1.1 // indirect
5754
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
5855
github.com/containerd/errdefs v1.0.0 // indirect
5956
github.com/containerd/errdefs/pkg v0.3.0 // indirect
60-
github.com/containerd/log v0.1.0 // indirect
6157
github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect
6258
github.com/coreos/go-oidc/v3 v3.14.1 // indirect
6359
github.com/cyphar/filepath-securejoin v0.6.0 // indirect
6460
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
65-
github.com/docker/go-metrics v0.0.1 // indirect
6661
github.com/docker/go-units v0.5.0 // indirect
67-
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
6862
github.com/felixge/httpsnoop v1.0.4 // indirect
6963
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
7064
github.com/go-logr/logr v1.4.3 // indirect
@@ -86,15 +80,10 @@ require (
8680
github.com/moby/sys/user v0.4.0 // indirect
8781
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
8882
github.com/modern-go/reflect2 v1.0.2 // indirect
89-
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
9083
github.com/opencontainers/runtime-spec v1.2.1 // indirect
9184
github.com/opencontainers/selinux v1.13.0 // indirect
9285
github.com/pkg/errors v0.9.1 // indirect
9386
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
94-
github.com/prometheus/client_golang v1.22.0 // indirect
95-
github.com/prometheus/client_model v0.6.2 // indirect
96-
github.com/prometheus/common v0.63.0 // indirect
97-
github.com/prometheus/procfs v0.15.1 // indirect
9887
github.com/segmentio/ksuid v1.0.4 // indirect
9988
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
10089
github.com/sigstore/protobuf-specs v0.4.1 // indirect

image/go.sum

Lines changed: 0 additions & 56 deletions
Large diffs are not rendered by default.

image/pkg/docker/config/config_test.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/docker/cli/cli/config/configfile"
1616
"github.com/docker/cli/cli/config/credentials"
1717
configtypes "github.com/docker/cli/cli/config/types"
18-
"github.com/docker/docker/registry"
1918
"github.com/stretchr/testify/assert"
2019
"github.com/stretchr/testify/require"
2120
"go.podman.io/image/v5/docker/reference"
@@ -489,10 +488,10 @@ func TestGetCredentialsInteroperability(t *testing.T) {
489488

490489
// Log in. This is intended to match github.com/docker/cli/command/registry.runLogin
491490
serverAddress := c.loginKey
492-
if serverAddress == "" {
493-
serverAddress = registry.IndexServer
491+
if serverAddress == "" || serverAddress == "docker.io" { // github.com/docker/cli/internal/registry.DefaultNamespace
492+
serverAddress = "https://index.docker.io/v1/" // github.com/docker/cli/internal/registry.IndexServer
494493
}
495-
if serverAddress != registry.IndexServer {
494+
if serverAddress != "https://index.docker.io/v1/" { // github.com/docker/cli/internal/registry.IndexServer
496495
serverAddress = credentials.ConvertToHostname(serverAddress)
497496
}
498497
configFile, err := config.Load(configDir)
@@ -514,7 +513,7 @@ func TestGetCredentialsInteroperability(t *testing.T) {
514513
// Log out. This is intended to match github.com/docker/cli/command/registry.runLogout
515514
var regsToLogout []string
516515
if c.loginKey == "" {
517-
regsToLogout = []string{registry.IndexServer}
516+
regsToLogout = []string{"https://index.docker.io/v1/"} // github.com/docker/cli/internal/registry.IndexServer
518517
} else {
519518
hostnameAddress := credentials.ConvertToHostname(c.loginKey)
520519
regsToLogout = []string{c.loginKey, hostnameAddress, "http://" + hostnameAddress, "https://" + hostnameAddress}
@@ -915,11 +914,11 @@ func TestSetCredentialsInteroperability(t *testing.T) {
915914
dockerRef, err := dockerReference.ParseNormalizedNamed(c.queryRepo)
916915
require.NoError(t, err)
917916
dockerRef = dockerReference.TagNameOnly(dockerRef)
918-
repoInfo, err := registry.ParseRepositoryInfo(dockerRef)
919-
require.NoError(t, err)
920-
configKey := repoInfo.Index.Name
921-
if repoInfo.Index.Official {
922-
configKey = registry.IndexServer
917+
configKey := dockerReference.Domain(dockerRef)
918+
// github.com/docker/cli/command.RetrieveAuthTokenFromImage’s getAuthConfigKey internally hard-codes
919+
// these strings.
920+
if configKey == "docker.io" || configKey == "index.docker.io" {
921+
configKey = "https://index.docker.io/v1/" // github.com/docker/cli/command.authConfigKey
923922
}
924923

925924
if c.otherContents {
@@ -933,7 +932,7 @@ func TestSetCredentialsInteroperability(t *testing.T) {
933932
// Initially, there are no credentials
934933
configFile, err := config.Load(configDir)
935934
require.NoError(t, err)
936-
creds, err := configFile.GetCredentialsStore(configKey).Get(configKey)
935+
creds, err := configFile.GetAuthConfig(configKey)
937936
require.NoError(t, err)
938937
assert.Equal(t, configtypes.AuthConfig{}, creds)
939938

@@ -947,7 +946,7 @@ func TestSetCredentialsInteroperability(t *testing.T) {
947946
// We can find the credentials.
948947
configFile, err = config.Load(configDir)
949948
require.NoError(t, err)
950-
creds, err = configFile.GetCredentialsStore(configKey).Get(configKey)
949+
creds, err = configFile.GetAuthConfig(configKey)
951950
require.NoError(t, err)
952951
assert.Equal(t, configtypes.AuthConfig{
953952
ServerAddress: configKey,
@@ -961,12 +960,12 @@ func TestSetCredentialsInteroperability(t *testing.T) {
961960
// We can’t find the credentials any more.
962961
configFile, err = config.Load(configDir)
963962
require.NoError(t, err)
964-
creds, err = configFile.GetCredentialsStore(configKey).Get(configKey)
963+
creds, err = configFile.GetAuthConfig(configKey)
965964
require.NoError(t, err)
966965
assert.Equal(t, configtypes.AuthConfig{}, creds)
967966

968967
if c.otherContents {
969-
creds, err = configFile.GetCredentialsStore("unmodified-domain.example").Get("unmodified-domain.example")
968+
creds, err = configFile.GetAuthConfig("unmodified-domain.example")
970969
require.NoError(t, err)
971970
assert.Equal(t, configtypes.AuthConfig{
972971
ServerAddress: "unmodified-domain.example",

vendor/github.com/beorn7/perks/LICENSE

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)