| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
About tar, maybe create it with text instructions in container and then copy from container (command already exists)? |
Sorry, something went wrong.
|
|
||
| final Image image = findImageWithId(expectedImageId, dockerClient.listImagesCmd().exec()); | ||
|
|
||
| assertNotNull(image, "Can't find expected image after loading from a tar archive"); |
There was a problem hiding this comment.
please use hamcrest matchers
Sorry, something went wrong.
|
in general lgtm beside comments |
Sorry, something went wrong.
|
Or even you can generate tar with apache.io tar, should be not so much lines of code! |
Sorry, something went wrong.
Please, give me more details. This image tarball should have a strict format. |
Sorry, something went wrong.
|
Sorry, right name of library https://commons.apache.org/proper/commons-compress/tar.html that would work for creating tar. Not sure about The layer.tar file contains aufs style .wh..wh.aufs files and directories for storing attribute changes and deletions. How you created it now? |
Sorry, something went wrong.
|
And one more idea, could you check how docker tests this case? https://github.com/docker/docker/search?utf8=%E2%9C%93&q=layer.tar |
Sorry, something went wrong.
|
|
||
| @Test | ||
| public void loadImageFromTar() throws Exception { | ||
| final Path imageTarFile = Paths.get("src/test/resources/testLoadImageFromTar/image.tar"); |
There was a problem hiding this comment.
please use CurrentThread classloader to get input stream - as of on different os this path may be changed
Sorry, something went wrong.
There was a problem hiding this comment.
That load from relative path, it related to maven plugin that executes it from root of project. So classloaders unrelated. Ideally you should put test resources under class_name/test_name and then load from classloader this test resource.
Sorry, something went wrong.
There was a problem hiding this comment.
Please give me an example of under class_name/test_name rule? It looks like directories in src/test/resources/ violates this rule. Should I use src/test/resources/LoadImageCmdImplTest/loadImageFromTar/image.tar? What if one resource is used by several classes?
Sorry, something went wrong.
There was a problem hiding this comment.
Then you can make public getter but place it in one place. The issue with placing just in resources that it will be like a trash can and after test deletions/refactorings they will be forgotten.
@leonsabr will search for examples bit later.
Sorry, something went wrong.
|
In order to get this tarball I manually did the following:
As I see, Docker guys have tarballs in repository: $ find docker -type f -name "*.tar" docker/integration-cli/fixtures/load/emptyLayer.tar docker/pkg/archive/testdata/broken.tar docker/pkg/tarsum/testdata/46af0962ab5afeb5ce6740d4d91652e69206fc991fd5328c1a94d364ad00e457/layer.tar docker/pkg/tarsum/testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/layer.tar docker/pkg/tarsum/testdata/collision/collision-0.tar docker/pkg/tarsum/testdata/collision/collision-1.tar docker/pkg/tarsum/testdata/collision/collision-2.tar docker/pkg/tarsum/testdata/collision/collision-3.tar docker/pkg/tarsum/testdata/xattr/layer.tar As I understand you suggest to have text files in resources, then in runtime create a tarball according to format? It is tricky because tarball contains layer tarballs inside. So you need to create correct layer tarballs, then put them in the image tarball. By the way, I can do a smaller tarball, with one layer, a few kB. |
Sorry, something went wrong.
|
Or we can pick some their tarball.. |
Sorry, something went wrong.
|
So ok to have tarball in repo. But please place under corresponding class name |
Sorry, something went wrong.
|
What was changed in second commit:
I will squash commits for cleaner history later. |
Sorry, something went wrong.
|
|
||
| CreateImageCmd createImageCmd(@Nonnull String repository, @Nonnull InputStream imageStream); | ||
|
|
||
| LoadImageCmd loadImageCmd(@Nonnull InputStream imageStream); |
There was a problem hiding this comment.
When this feature appeared in docker API? Could you place javadoc with since (example could be found through search) ?
Sorry, something went wrong.
|
LGTM, javadoc with API version would be welcome. |
Sorry, something went wrong.
|
It was tricky but I found the first reference of this endpoint in docs/reference/api/docker_remote_api_v1.7.md. Now this docs are removed from the Docker website. I squashed commits, so now all changes are in a single commit. |
Sorry, something went wrong.
|
@leonsabr thanks! it was enough to check latest 3-4 api versions and mark with latest known. I don't think that anybody using 1.8 :) |
Sorry, something went wrong.
|
@leonsabr 1.12 build fails with Tests run: 323, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 556.507 sec <<< FAILURE! - in TestSuite (com.github.dockerjava.netty.exec.LoadImageCmdExecTest) Time elapsed: 0.152 sec <<< FAILURE! io.netty.handler.codec.CorruptedFrameException: invalid JSON received at byte position 0: 4c6f6164656420696d6167653a20646f636b65722d6a6176612f6c6f61643a312e300a Results : Failed tests: LoadImageCmdExecTest.loadImageFromTar » CorruptedFrame invalid JSON received a... Plus i found that it has verbose output #664 |
Sorry, something went wrong.
|
|
||
| /** | ||
| * Online documentation is not available anymore. | ||
| */ |
There was a problem hiding this comment.
sinde docker 1.7 or 1.7 API?
Sorry, something went wrong.
There was a problem hiding this comment.
found
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This is an implementation of POST /images/load endpoint.
A few words about testing. I added a small tarball (20 kB) with a single image named "docker-java/load:1.0". Tests try to load this tarball into docker, check if expected image appears, and remove it in @AfterMethod. Test for netty implementation is the same as for jaxrs/jersey implementation.
This change is