-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
integration-cli: remove bash dependency of TestRunSlowStdoutConsumer #10804
Conversation
LGTM |
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
|
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. |
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
|
@@ -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") |
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 a bash-ism -- this ought to be > /dev/null 2>&1
instead
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.
nice catch!
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.
fixing while I'm at it.
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.
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.
I wonder why this was going through bash to begin with. |
@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") |
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.
Can we get rid of "-i" as well since we aren't doing anything with stdin?
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.
@cpuguy83 fair point, I didn't know stdout was getting attached without -i
. :)
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>
LGTM |
…utConsume-fix integration-cli: remove bash dependency of TestRunSlowStdoutConsumer
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