-
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
Conversation
There have been a long string of bugs discovered while testing this functionality, and it's quite important the we ensure that this doesn't break. Signed-off-by: Aleksa Sarai <[email protected]>
|
DO NOT MERGE. This depends on containers/image#193 |
mtrmac
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.
(Very nitpicky comments, feel free to ignore; and most importantly, containers/image#192 needs to be decided first.)
|
|
||
| // docker-archive -> OCI image layout | ||
| ociDest := "busybox-latest" | ||
| defer os.RemoveAll(ociDest) |
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.
Why is this one not a TempDir as above? (Perhaps check how TestCopyDirSignature does this, with so many directories.)
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.
Yes, it should be a TempDir.
| c.Assert(err, check.IsNil) | ||
| } | ||
|
|
||
| // Make sure that docker-archive is identical to docker. |
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.
| // "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) |
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.
Is it essential that this uncompressess the layers (per #279 and containers/image#193 ), or does it not matter here?
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 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 docker-archive: case but I don't think it'll happen in the docker:// case.
But first lets get the other stuff merged and we can figure out how to make a nice integration test once the code works.
| assertSkopeoSucceeds(c, "", "copy", "docker-archive:"+ar1+"/archive.tar", "dir:"+dir1) | ||
| // "pull": docker: → dir: | ||
| assertSkopeoSucceeds(c, "", "copy", "docker://busybox", "dir:"+dir2) | ||
| out := combinedOutputOfCommand(c, "diff", "-urN", dir1, dir2) |
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.
Sure, layers should match (either uncompressed or unmodified); but why should we expect the manifest, which has been thrown away in the copy to docker-archive:ar1, and generated from scratch in the copy from it, to match (and keep matching) byte-for-byte the manifest stored in the remote docker://busybox repo?
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.
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.
|
|
||
| // OCI image layout -> docker-archive | ||
| assertSkopeoSucceeds(c, "", "copy", "oci:"+ociDest, "docker-archive:"+ar2+"/archive.tar") | ||
| c.Assert(err, check.IsNil) |
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.
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?
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.
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.
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.
For example, the most recent series of issues we've seen would've been caught by this smoke test.
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.
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).
|
#305 wouldn't have happened if we had these tests in place... sigh |
|
I'm going to make a separate PR for doing regular |
FWIW, note that containers/image#148 is still pending. |
|
Yeah, which is why I've split out #306 so we get /some/ tests in place. |
|
Is this pull request still being worked on ? |
|
I haven't touched this in a while, but we still should include these tests. Also, there are some other issues that I've found in I'll rebase and rework this patch when I get a chance this week. |
|
@cyphar This needs an update or it needs to be closed. |
|
/me will rebase (and probably rewrite) this. |
|
@cyphar Nothing has happened to this PR in 6 months, should I close? |
|
@cyphar I am closing this since nothing has happened in over a year. Reopen if you are still interested in workin on it. |
There have been a long string of bugs discovered while testing this
functionality, and it's quite important the we ensure that this doesn't
break.
Signed-off-by: Aleksa Sarai [email protected]