integration-cli: Fix race in TestServiceLogsFollow test case
integration-cli: Fix race in TestServiceLogsFollow test case

Imagine that in test TestServiceLogsFollow the service
TestServiceLogsFollow would print "log test" message to pipe exactly 3
times before cmd.Process.Kill() would kill the service in the end of
test. This means that goroutine would hang "forever" in
reader.Readline() because it can't read anything from pipe but pipe
write end is still left open by the goroutine.

This is standard behaviour of pipes, one should close the write end
before reading from the read end, else reading would block forever.

This problem does not fire frequently because the service normally
prints "log test" message at least 4 times, but we saw this hang on our
test runs in Virtuozzo.

We can't close the write pipe end before reading in a goroutine because
the goroutine is basicly a thread and closing a file descrptor would
close it for all other threads and "log test" would not be printed at
all.

So I see another way to handle this race, we can just defer pipe close
to the end of the main thread of the test case after killing the
service. This way goroutine's reading would be interrupted and it would
finish eventually.

Signed-off-by: Pavel Tikhomirov <3e8c75167f9f00ca74287a4609f1507a2696e07e@virtuozzo.com>

moul/docker,thaJeztah/docker,cpuguy83/docker,moul/docker,cpuguy83/docker,konstruktoid/docker-upstream,Mokolea/docker,Mokolea/docker,Ramzec/docker,jimjag/docker,Mokolea/docker,jimjag/docker,moby/moby,konstruktoid/docker-upstream,trebonian/docker,trebonian/docker,cpuguy83/docker,moby/moby,thaJeztah/docker,mahak/docker,konstruktoid/docker-upstream,Ramzec/docker,Ramzec/docker,nawawi/docker,moby/moby,nawawi/docker,thaJeztah/docker,mahak/docker,nawawi/docker,trebonian/docker,jimjag/docker,konstruktoid/docker-upstream,thaJeztah/docker,moby/moby,mahak/docker,nawawi/docker,mahak/docker,moul/docker,moul/docker,cpuguy83/docker,jimjag/docker,Mokolea/docker,Ramzec/docker,trebonian/docker