-
Notifications
You must be signed in to change notification settings - Fork 900
integration: add test for OCI <-> docker-archive translation #280
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,6 +151,43 @@ func (s *CopySuite) TestCopySimple(c *check.C) { | |
| c.Assert(err, check.IsNil) | ||
| } | ||
|
|
||
| // Make sure that docker-archive is identical to docker. | ||
| func (s *CopySuite) TestCopyArchive(c *check.C) { | ||
| ar1, err := ioutil.TempDir("", "ar-1") | ||
| c.Assert(err, check.IsNil) | ||
| defer os.RemoveAll(ar1) | ||
| ar2, err := ioutil.TempDir("", "ar-2") | ||
| c.Assert(err, check.IsNil) | ||
| defer os.RemoveAll(ar2) | ||
| dir1, err := ioutil.TempDir("", "copy-1") | ||
| c.Assert(err, check.IsNil) | ||
| defer os.RemoveAll(dir1) | ||
| dir2, err := ioutil.TempDir("", "copy-2") | ||
| c.Assert(err, check.IsNil) | ||
| defer os.RemoveAll(dir2) | ||
|
|
||
| // FIXME: It would be nice to use one of the local Docker registries instead of neeeding an Internet connection. | ||
| // "pull": docker: → docker-archive: | ||
| assertSkopeoSucceeds(c, "", "copy", "docker://busybox", "docker-archive:"+ar1+"/archive.tar:busybox") | ||
| // "copy": docker-archive: → dir: | ||
| assertSkopeoSucceeds(c, "", "copy", "docker-archive:"+ar1+"/archive.tar", "dir:"+dir1) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it essential that this uncompressess the layers (per #279 and containers/image#193 ), or does it not matter here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does matter for the test below. However, since the original idea behind containers/image#193 was NACK'd, the current system will have the blobs decompressed in the But first lets get the other stuff merged and we can figure out how to make a nice integration test once the code works. |
||
| // "pull": docker: → dir: | ||
| assertSkopeoSucceeds(c, "", "copy", "docker://busybox", "dir:"+dir2) | ||
| out := combinedOutputOfCommand(c, "diff", "-urN", dir1, dir2) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, layers should match (either uncompressed or unmodified); but why should we expect the manifest, which has been thrown away in the copy to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll split this test to look like #306, where we have a test that checks something that must be invariant but also an extra test that checks the things-that-should-be-the-same, with a comment explaining the situation. |
||
| c.Assert(out, check.Equals, "") | ||
|
|
||
| // docker-archive -> OCI image layout | ||
| ociDest := "busybox-latest" | ||
| defer os.RemoveAll(ociDest) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this one not a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it should be a |
||
| assertSkopeoSucceeds(c, "", "copy", "docker-archive:"+ar1+"/archive.tar", "oci:"+ociDest) | ||
| _, err = os.Stat(ociDest) | ||
| c.Assert(err, check.IsNil) | ||
|
|
||
| // OCI image layout -> docker-archive | ||
| assertSkopeoSucceeds(c, "", "copy", "oci:"+ociDest, "docker-archive:"+ar2+"/archive.tar") | ||
| c.Assert(err, check.IsNil) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these two copies intended to be just a minimal smoke test, or is there a more specific kind of failure this is testing for?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There were a variety of failures that would happen if you tried to test going from OCI to Docker, back to OCI then back to Docker. This is a smoke test to ensure that at the very least we don't have asymmetric issues with one side of the conversion.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, the most recent series of issues we've seen would've been caught by this smoke test.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, I will add some extra round-trip style tests (like #306) once the two important PRs are merged. I'm not going to waste time writing lots of detailed tests until we all agree on the implementations (especially semantics like compression, which massively change what invariants we can test). |
||
| } | ||
|
|
||
| // Streaming (skopeo copy) | ||
| func (s *CopySuite) TestCopyStreaming(c *check.C) { | ||
| dir1, err := ioutil.TempDir("", "streaming-1") | ||
|
|
||
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.
This is not really describing the test… what would “a local file being identical to a remote repository” (or is it “to a daemon”) mean? And docker does nothing with OCI…
I guess, a test is a test is a test, and it is useful even if not explained, but knowing what is being tested could make it easier in the future to figure out whether a failure is a bug in the test or in the software being tested.