Skip to content
This repository was archived by the owner on Nov 19, 2026. It is now read-only.

pkg/docker/config/config_test: Stabilize "normalize registry" test - #626

Merged
rhatdan merged 2 commits into
containers:masterfrom
wking:normalize-registry-test-flake
May 14, 2019
Merged

rhatdan merged 2 commits into
containers:masterfrom
wking:normalize-registry-test-flake

Conversation

@wking

@wking wking commented May 11, 2019

Copy link
Copy Markdown
Contributor

In 1c0fb51 (#593), I changed the test data for this test from:

makeTestAuthConfig(testAuthConfigDataMap{
  "docker.io":      testAuthConfigData{"user", "pw"},
  "localhost:5000": testAuthConfigData{"joe", "pass"},
})

to the full.json fixture which includes:

{
  "auths": {
    "example.org": {
      "auth": "ZXhhbXBsZTpvcmc="
    },
    "index.docker.io": {
      "auth": "aW5kZXg6ZG9ja2VyLmlv"
    },
    "docker.io": {
      "auth": "ZG9ja2VyOmlv"
    },
    ...
  }
}

That lead ordering instability matching the normalized docker.io, with it occasionally matching the expected docker.io entry, and occasionally matching the index.docker.io entry. With this commit, I'm adjusting the hostname to be based on example.org to avoid such ambiguity in target matching while still excercising all the normalization logic that was being excercised before 1c0fb51.

In 1c0fb51 (pkg/docker/config/testdata: Add credential-file
fixtures, 2019-02-28, containers#593), I changed the test data for this test
from:

  makeTestAuthConfig(testAuthConfigDataMap{
    "docker.io":      testAuthConfigData{"user", "pw"},
    "localhost:5000": testAuthConfigData{"joe", "pass"},
  })

to the full.json fixture which includes:

  {
    "auths": {
      "example.org": {
        "auth": "ZXhhbXBsZTpvcmc="
      },
      "index.docker.io": {
        "auth": "aW5kZXg6ZG9ja2VyLmlv"
      },
      "docker.io": {
        "auth": "ZG9ja2VyOmlv"
      },
      ...
    }
  }

That lead ordering instability matching the normalized docker.io, with
it occasionally matching the expected docker.io entry, and
occasionally matching the index.docker.io entry.  With this commit,
I'm adjusting the hostname to be based on example.org to avoid such
ambiguity in target matching while still excercising all the
normalization logic that was being excercised before 1c0fb51.

Signed-off-by: W. Trevor King <[email protected]>
@wking

wking commented May 11, 2019

Copy link
Copy Markdown
Contributor Author

Checking for flake-fixing-ness:

$ go test -count 100 ./pkg/docker/config
ok  	github.com/containers/image/pkg/docker/config	0.377s

@mtrmac

mtrmac commented May 13, 2019

Copy link
Copy Markdown
Collaborator

@vrothberg PTAL; consider also #624.

(This fix seems correct to me, FWIW.)

@vrothberg

Copy link
Copy Markdown
Member

LGTM 👍 I'll shamelessly click on Update branch, so we can merge it if everybody is on the same page. Thanks, @wking and @mtrmac!

@rhatdan
rhatdan merged commit 1abdd5f into containers:master May 14, 2019
@wking
wking deleted the normalize-registry-test-flake branch May 15, 2019 01:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants