Skip to content
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: remove bash dependency of TestRunSlowStdoutConsumer #10804

Merged
merged 1 commit into from Feb 16, 2015
Merged

integration-cli: remove bash dependency of TestRunSlowStdoutConsumer #10804

merged 1 commit into from Feb 16, 2015

Conversation

ahmetb
Copy link
Contributor

@ahmetb ahmetb commented Feb 14, 2015

This makes this test case run on msys bash on windows or
cmd.exe. On windows, os.Exec("/bin/bash") simply fails because
that's not the correct abspath.

Signed-off-by: Ahmet Alp Balkan ahmetalpbalkan@gmail.com
Label: #windows
cc: @unclejack @cpuguy83 @tianon @tiborvass

@tiborvass
Copy link
Contributor

LGTM

@duglin
Copy link
Contributor

duglin commented Feb 14, 2015

As these changes are being made should we be adding some kind of validation tests to make sure people don't add them back in?

And perhaps a page telling people what constructs to avoid and which to use ?

-Doug

Sent from my iPhone

On Feb 14, 2015, at 5:17 PM, Tibor Vass notifications@github.com wrote:

LGTM


Reply to this email directly or view it on GitHub.

@ahmetb
Copy link
Contributor Author

ahmetb commented Feb 14, 2015

I'm not sure how we can validate that. If you're referring to bash usage, that'd be an obvious failure in Windows CI.

@duglin
Copy link
Contributor

duglin commented Feb 15, 2015

I just don’t want you to have to continually make these kinds of edits over and over - nor wait for a windows build - so if we can add something like the validate-gofmt tests then we’ll know if someone uses something they shouldn’t

-Doug

On Feb 14, 2015, at 6:45 PM, Ahmet Alp Balkan notifications@github.com wrote:

I'm not sure how we can validate that. If you're referring to bash usage, that'd be an obvious failure in Windows CI.

—Alp
http://alp.im

On Sat, Feb 14, 2015 at 3:37 PM, Doug Davis notifications@github.com
wrote:

As these changes are being made should we be adding some kind of validation tests to make sure people don't add them back in?
And perhaps a page telling people what constructs to avoid and which to use ?
-Doug
Sent from my iPhone

On Feb 14, 2015, at 5:17 PM, Tibor Vass notifications@github.com wrote:

LGTM


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub:
#10804 (comment)

Reply to this email directly or view it on GitHub #10804 (comment).

@@ -2617,7 +2617,7 @@ func TestRunVolumesCleanPaths(t *testing.T) {
func TestRunSlowStdoutConsumer(t *testing.T) {
defer deleteAllContainers()

c := exec.Command("/bin/bash", "-c", dockerBinary+` run --rm -i busybox /bin/sh -c "dd if=/dev/zero of=/foo bs=1024 count=2000 &>/dev/null; catv /foo"`)
c := exec.Command(dockerBinary, "run", "--rm", "-i", "busybox", "/bin/sh", "-c", "dd if=/dev/zero of=/foo bs=1024 count=2000 &>/dev/null; catv /foo")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&> is a bash-ism -- this ought to be > /dev/null 2>&1 instead

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing while I'm at it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this with dd if=/dev/zero of=/dev/stdout bs=1024 count=2000 | catv because at the end test wants to stream just 1024 * 2 * 2000 chars.

@cpuguy83
Copy link
Member

I wonder why this was going through bash to begin with.

@ahmetb
Copy link
Contributor Author

ahmetb commented Feb 15, 2015

@cpuguy83 hehe no idea. many tests using binary stdout results from dockerBinary were using bash. I don't think there's a particular benefit of using bash in these cases.

@@ -2617,7 +2617,7 @@ func TestRunVolumesCleanPaths(t *testing.T) {
func TestRunSlowStdoutConsumer(t *testing.T) {
defer deleteAllContainers()

c := exec.Command("/bin/bash", "-c", dockerBinary+` run --rm -i busybox /bin/sh -c "dd if=/dev/zero of=/foo bs=1024 count=2000 &>/dev/null; catv /foo"`)
c := exec.Command(dockerBinary, "run", "--rm", "-i", "busybox", "/bin/sh", "-c", "dd if=/dev/zero of=/dev/stdout bs=1024 count=2000 | catv")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of "-i" as well since we aren't doing anything with stdin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuguy83 fair point, I didn't know stdout was getting attached without -i. :)

@cpuguy83
Copy link
Member

LGTM just one nit.

This makes this test case run on msys bash on windows or
cmd.exe.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
@jessfraz
Copy link
Contributor

LGTM

jessfraz pushed a commit that referenced this pull request Feb 16, 2015
…utConsume-fix

integration-cli: remove bash dependency of TestRunSlowStdoutConsumer
@jessfraz jessfraz merged commit 110ce4f into moby:master Feb 16, 2015
@ahmetb ahmetb deleted the win-cli/TestRunSlowStdoutConsume-fix branch February 16, 2015 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants