From 09b19fe8a31a61c04dedaa0ddec44576abad57c2 Mon Sep 17 00:00:00 2001 From: Adrian Villin Date: Thu, 18 Jul 2024 08:33:59 +0200 Subject: hs-test: fix docker log output when logs are empty - removed "==> /dev/null <==" and "tail: cannot open..." lines when docker logs are empty Type: test Change-Id: Ia51f7aa41d2c6c04c0adcb82142abfd45fbe2728 Signed-off-by: Adrian Villin --- extras/hs-test/infra/container.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extras/hs-test/infra/container.go b/extras/hs-test/infra/container.go index d71761b2920..5093398ae56 100644 --- a/extras/hs-test/infra/container.go +++ b/extras/hs-test/infra/container.go @@ -463,7 +463,14 @@ func (c *Container) log(maxLines int) (string, error) { stdout := stdoutBuf.String() stderr := stderrBuf.String() - return stdout + " " + stderr, err + if strings.Contains(stdout, "==> /dev/null <==") { + stdout = "" + } + if strings.Contains(stderr, "tail: cannot open") { + stderr = "" + } + + return stdout + stderr, err } func (c *Container) stop() error { -- cgit 1.2.3-korg