-
Notifications
You must be signed in to change notification settings - Fork 593
specs-go/round_trip_test: Add round-trip testing for the config #759
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3715b4c to
750562b
Compare
This was referenced May 9, 2017
Contributor
Author
Member
|
I think this is ready for the mentioned rebase? I'm personally pretty indifferent on the change either way, and don't think it really warrants holding up 1.0 (seems like a good way for us to verify our work is self-consistent, but not a strict requirement). |
To make sure the Go structs can accurately transport known-good configurations. Use Docker's canonical JSON implementation so we don't have to worry about false-positives due to JSON whitespace, key order, etc. Signed-off-by: W. Trevor King <[email protected]>
And run them from Travis. Also replace some old Travis test commands with a single call to 'make test'. Now we die on the first error (e.g. we don't run the Go tests if lint fails), but I don't think that's a big problem, and this way we don't have to maintain two parallel lists of test targets. Signed-off-by: W. Trevor King <[email protected]>
process.user.username is not strictly required yet, but it is intended to be [1], and it doesn't seem worth making Process.User a pointer in the meantime. [1]: opencontainers#618 (comment) Signed-off-by: W. Trevor King <[email protected]>
Avoiding:
$ go test ./specs-go
--- FAIL: TestConfigRoundTrip (0.00s)
--- FAIL: TestConfigRoundTrip/config_2 (0.00s)
round_trip_test.go:35: failed to round-trip:
{"ociVersion":"1.0.0","platform":{"os":"windows","arch":"amd64"},"process":{"user":{"uid":0,"gid":0,"username":"containeradministrator"},"args":["sh"],"cwd":"C:\\"},"root":{"path":"rootfs"}}
FAIL
FAIL github.com/opencontainers/runtime-spec/specs-go 0.003s
We can't just add omitempty (without also making them pointers),
because 0 is a meaningful value for both properties.
Signed-off-by: W. Trevor King <[email protected]>
750562b to
05415d4
Compare
Contributor
Author
|
On Wed, May 10, 2017 at 09:37:12PM -0700, Tianon Gravi wrote:
I think this is ready for the mentioned rebase?
Rebased with 750562b → 05415d4.
I think we still want the UID and GID pointers from 05415d4. My
(possibly muddled) recollection from the 2017-05-09 meeting [1] is
that @crosbymichael preferred “no pointers if a property is REQUIRED
on any platform”, even though that means that you can't reliably use
Go's default JSON serializer. For example, the Go types in master
will currently inject:
"uid":0,"gid":0
into process.user if you use Go's JSON serializer even though those
fields are not defined for Windows. I'd offered to pull that commit
out into its own PR, where @crosbymichael could reject it (and give
his motivation in his own words), but he didn't seem to keen on that
either. If my understanding of his preferred policy is accurate and
sounds appealing to other maintainers, I can submit a PR updating [2]
(although it may be faster if someone who personally holds that
position works up the style PR).
… and don't think it really warrants holding up 1.0…
Right. And we can always cut 1.0.1 with improved Go types for
consumers handling the 1.0 Markdown spec. But if we can form a
consensus on this either way before 1.0, I think we should do that and
avoid risking a post-1.0 fixup.
[1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2017/opencontainers.2017-05-09-20.07.log.html#l-71
[2]: https://github.com/opencontainers/runtime-spec/blob/1259a08e003658f8c4094a6bbc9f52aee29c95df/style.md#optional-settings-should-not-have-pointer-go-types
|
Contributor
Author
|
@mrunalp, I think you were going to add a comment (or file a |
This was referenced May 24, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To make sure the Go structs can accurately transport known-good configurations.
Also use a pointer for
Process.ConsoleSizeto avoid:Background on this in golang/go#11939.