-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Using dockerCmd when possible #12838
Conversation
|
runCommandWithOutput(cmd) | ||
cmd = exec.Command(dockerBinary, "ps", "-s", "-n=1") | ||
baseOut, _, err := runCommandWithOutput(cmd) | ||
exec.Command(dockerBinary, "run", "-d", "busybox", "echo", "hello").Run() |
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.
check err (even if it wasn't checked)?
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 thought to do so, but I preferred to not change it's behaviour. I'm using dockerCmd now.
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.
prob ok
small nits, rest seems alright |
@@ -40,13 +40,12 @@ func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) { | |||
|
|||
out, _ := dockerCmd(c, "images", "-q") | |||
image := strings.Split(out, "\n")[0] | |||
eventsCmd := exec.Command(dockerBinary, "run", "--name", "testeventdie", image, "blerg") | |||
_, _, err := runCommandWithOutput(eventsCmd) | |||
err := exec.Command(dockerBinary, "run", "--name", "testeventdie", image, "blerg").Run() |
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.
you could compact the the if below with this statement but it's just sugar
I personally hate |
@LK4D4 when you say "real source", do you mean the location of the source file (...test.go) that had the bad cmd? |
@duglin I mean code line too. |
I like it when the cmd you are running is more of a test setup than the actual thing your testing. |
I don't like passing |
@LK4D4 I was just wondering if it would help to have |
@duglin I don't feel nice about reading and debugging reflect-code when I can just see where really error was occured. I had problems with that before in integration-cli helpers and I prefer readability over writability and I personally don't care about |
Actually, go-check does report the correct caller for you. |
I'm probably in the minority here but I don't have a problem with utility functions doing more than setup work. They are certainly good for that but I also view utility functions as things to make writing testcases easier. So, moving code that appears in a lot of tests into a func to save people from having to duplicate that code over and over is ok with me - even if that func is the one doing the functional testing or doing the c.Fatal() call (as long as it reports the proper info so people know which test to look at to see what was being tested). But I won't -1 removing it since its not that big of an issue - just more replicated code in the test. |
alright, I think that now that there is |
heh, I'd say
|
ok, I just like to have just one way of doing things, above all in tests suite where it's super easy to just implement functions for some use cases and then just forget. Instead a clean interface will make things clear immediately on how to run a container, a container with output etc etc |
@fntlnz could you please rebase and have |
Yeah I'll do all this evening along with the other pr assigned to me. :)
|
Signed-off-by: Lorenzo Fontana <fontanalorenzo@me.com>
LGTM |
ping @runcom |
LGTM. Merging 🎉 |
No description provided.