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

integration-cli: use pipes for save/load tests #10806

Merged
merged 1 commit into from Feb 19, 2015

Conversation

Projects
None yet
6 participants
@ahmetb
Contributor

ahmetb commented Feb 14, 2015

This removes bash dependency from save/load integration tests.
It used to call /bin/bash -c 'c:\...\docker.exe' which is not valid
when executed on Windows.

Also removed usage of tempdirs and temp files for saving/loading
repos. All are now done using in-memory pipes and buffers.

Created runCommandPipelineWithOutput(...cmd) helper to replace the
/bin/bash -c 'a | b | c' using pipes and returning output from
last command in the pipeline. This makes the code even shorter
and readable.

Signed-off-by: Ahmet Alp Balkan ahmetalpbalkan@gmail.com
Label: #windows
cc: @unclejack @vbatts @vieux @jfrazelle @a-ba @tianon

@tianon

This comment has been minimized.

Member

tianon commented Feb 16, 2015

LGTM 👍

I want this for #10750 now! 😄

@tianon

This comment has been minimized.

Member

tianon commented Feb 17, 2015

--- FAIL: TestSaveSingleTag (0.46s)
    docker_cli_save_load_test.go:152: failed to save repo with image ID and 'repositories' file: , exit status 1
[PASSED]: save - save a image by ID
[PASSED]: save - save a repo using -o && load a repo using -i
--- FAIL: TestSaveMultipleNames (0.16s)
    docker_cli_save_load_test.go:288: failed to save multiple repos: , exit status 1
--- FAIL: TestSaveRepoWithMultipleImages (1.80s)
    docker_cli_save_load_test.go:349: achive does not contains the right layers: got [], expected [022602255a522cdc56c90787ef95f35b6c29ea43aa49f23e11c0b982ac31f9a3 522d1604e1a0aaad296fff54dab5e062e1d2892b8542095fae0f24874e785797 7fd0431ef4468370712b452bbdc5c7eef13b71796c8f6ad4157ec6bfce35f0b5 aae965979569e60ffd92ac3e9ef9e469a1b35c6f0a690e9ba912450db608af43 ba11eb266ed9a73e7a2d321e061735972eecbb4c24542082c21838eb9c635164]
@ahmetb

This comment has been minimized.

Contributor

ahmetb commented Feb 17, 2015

@tianon ugh. apparently we can do things can pass on windows and fail on linux... I'll look this sometime. lmk if you know you can see something right away.

out, _, err = runCommandPipelineWithOutput(
exec.Command(dockerBinary, "save", fmt.Sprintf("%v:latest", repoName)),
exec.Command("tar", "t"),
exec.Command("grep", "-E", fmt.Sprintf("'(^repositories$|%v)'", cleanedImageID)))

This comment has been minimized.

@tianon

tianon Feb 18, 2015

Member

OMG it's the single quotes here. Drop the single quotes inside the quotes here and we should be golden.

This comment has been minimized.

@tianon

tianon Feb 18, 2015

Member

If that doesn't work, it might be worth scripting the output of tar t directly (essentially implementing the grep in Go instead of shelling out), but I think getting the test converted as-is first is a good first step, personally.

This comment has been minimized.

@ahmetb

ahmetb Feb 18, 2015

Contributor

@tianon are you sure it's the single quotes? all other tests regarding this change are failing, too. also the quotes were there and we're basically keeping it in this change. I doubt that's the problem.

This comment has been minimized.

@tianon

tianon Feb 18, 2015

Member

I'm positive it's the quotes, because they were there as an artifact of the shell syntax to ensure this argument was passed correctly, which exec.Command already does for us regardless of the shell.

This comment has been minimized.

@tianon

tianon Feb 18, 2015

Member

So, why isn't this test failing, since it still has the quotes? 😟

This comment has been minimized.

@ahmetb

ahmetb Feb 18, 2015

Contributor

@tianon you're probably looking at an older commit. see b81105e.

out, _, err = runCommandPipelineWithOutput(
exec.Command(dockerBinary, "save", fmt.Sprintf("%v-one", repoName), fmt.Sprintf("%v-two:latest", repoName)),
exec.Command("tar", "xO", "repositories"),
exec.Command("grep", "-q", "-E", "'(-one|-two)'"),

This comment has been minimized.

@tianon

tianon Feb 18, 2015

Member

Nice, same problem here -- drop the single quotes and it should be good.

out, _, err := runCommandPipelineWithOutput(
exec.Command(dockerBinary, "save", repoName),
exec.Command("tar", "t"),
exec.Command("grep", "'VERSION'"),

This comment has been minimized.

@tianon

tianon Feb 18, 2015

Member

Aha, again! 👍

This comment has been minimized.

@ahmetb

ahmetb Feb 18, 2015

Contributor

😢

integration-cli: use pipes for save/load tests
This removes `bash` dependency from save/load integration tests.
It used to call `/bin/bash -c 'c:\...\docker.exe'` which is not valid.
Also removed usage of tempdirs and temp files for saving/loading
repos. All are now done using in-memory pipes and buffers.

Created `runCommandPipelineWithOutput` helper to replace the
`/bin/bash -c 'a | b | c'` using pipes and returning output from
last command in the pipeline. This makes the code even shorter
and readable.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
@ahmetb

This comment has been minimized.

Contributor

ahmetb commented Feb 18, 2015

those are fixed now. yes it was 's around some args.

@tianon

This comment has been minimized.

Member

tianon commented Feb 19, 2015

LGTM

@jessfraz

This comment has been minimized.

Contributor

jessfraz commented Feb 19, 2015

Woooohooo it is time LGTM

jessfraz pushed a commit that referenced this pull request Feb 19, 2015

Jessie Frazelle
Merge pull request #10806 from ahmetalpbalkan/win-cli/TestSave-fix
integration-cli: use pipes for save/load tests

@jessfraz jessfraz merged commit cd9769c into moby:master Feb 19, 2015

1 of 2 checks passed

windows Jenkins build Windows-PRs 49 has failed
Details
janky Jenkins build Docker-PRs 1269 has succeeded
Details
@ahmetb

This comment has been minimized.

Contributor

ahmetb commented Feb 19, 2015

😂 👯👯👯👯

@ahmetb ahmetb deleted the ahmetb:win-cli/TestSave-fix branch Feb 19, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment