-
Notifications
You must be signed in to change notification settings - Fork 395
pkg/docker/config/testdata: Add credential-file fixtures #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg/docker/config/testdata: Add credential-file fixtures #593
Conversation
|
Something is segfaulting. |
From Travis: But I'm having trouble figuring out how I could have broken anything over in that package with: $ git show --oneline --stat
13eff85 pkg/docker/config/testdata: Add credential-file fixtures
pkg/docker/config/config_test.go | 314 ++++++++++---------------------
pkg/docker/config/testdata/abnormal.json | 22 +++
pkg/docker/config/testdata/example.json | 7 +
pkg/docker/config/testdata/full.json | 25 +++
pkg/docker/config/testdata/legacy.json | 8 +
5 files changed, 165 insertions(+), 211 deletions(-) |
|
That crash is certainly unrelated (unless this happens to modify the memory layout to make it reproducible? That would be great); I’ve been trying to figure out the cause but I haven’t found anything so far. |
|
Closed/opened to kick Travis, and now we're green. |
|
Anything I can do to help this along? 👼 |
13eff85 to
4520888
Compare
|
Bump :). This seems fairly straightforward and is green... |
|
@wking ping ... |
|
@wking Please rebase. |
We're primarily interested in maintaing compatibility with user's on-disk configurations, and using fixtures makes it harder to get that wrong. While I'm touching these tests, also use t.Run and assert.Equal to make it easier to read both the source and any test failure messages. Signed-off-by: W. Trevor King <wking@tremily.us>
4520888 to
1c0fb51
Compare
vrothberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
|
This introduces a flake (depending on in which order While the commit says “add fixtures”, it seems that not a single affected test case has actually been just ported without modification, and there’s no rationale for those modifications. So, while moving to fixtures instead of autogenerating data, and the use of |
Motivation was consolidating the number of fixture files, vs. the previous tests which had many arbitrary, per-test-case data variations. I tried to preserve only the variation necessary to excercise the tested behavior. Not sure about the flake yet. |
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 <wking@tremily.us>
|
I don’t doubt the good intention of the motivation, and, to be clear, the flake has been clearly useful to show that the config handler should be improved; whether or not such ambiguous input can legitimately happen, handling even unlikely ambiguous input consistently over time would help reliability. Still, it’s not at all trivial to determine that the old and new tests all have the same effect, and AFAICS the interpretation of this ambiguous input has been inconsistent this way in projectatomic/docker for a long time, so neither of these is clearly urgent; meanwhile we actively need need to get #625 and other mirror changes in before the next release, and these lower-priority changes with no clear user benefit slow that down. I’ll let @vrothberg decide this, I’m clearly not unbiased. |
Also, using frozen files is clearly better than generating them at test time, risking that the generator code can be refactored along with the consumers, breaking consumption of old files without anyone noticing. |
|
Let's move the discussion over to #626. |
We're primarily interested in maintaing compatibility with user's on-disk configurations, and using fixtures makes it harder to get that wrong.
While I'm touching these tests, also use
t.Runandassert.Equalto make it easier to read both the source and any test failure messages.