summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-07-24 17:46:53 +0200
committerDave Wallace <dwallacelf@gmail.com>2024-07-24 21:16:21 +0000
commitd9da4eeb7945ab039c182f6960a629b05dd5f024 (patch)
tree05100d02132007f120fbfbdf2ee491b8beb03009
parentf95c4d81fcffd15fe2e7af690f8294e7e04d8868 (diff)
hs-test: fix logs once again
- "/dev/null" and "tail: ..." messages should now be removed properly Type: test Change-Id: I4aa1f1a1cab17dab73f727e40c80a44d6e753bd5 Signed-off-by: Adrian Villin <avillin@cisco.com>
-rw-r--r--extras/hs-test/infra/container.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/extras/hs-test/infra/container.go b/extras/hs-test/infra/container.go
index 44f141a9102..46cee976556 100644
--- a/extras/hs-test/infra/container.go
+++ b/extras/hs-test/infra/container.go
@@ -468,12 +468,12 @@ func (c *Container) log(maxLines int) (string, error) {
stdout := stdoutBuf.String()
stderr := stderrBuf.String()
- if strings.Contains(stdout, "==> /dev/null <==") {
- stdout = ""
- }
- if strings.Contains(stderr, "tail: cannot open") {
- stderr = ""
- }
+ stdout = strings.Join(strings.Split(stdout, "==> /dev/null <=="), "")
+ stderr = strings.Join(strings.Split(stderr, "tail: cannot open '' for reading: No such file or directory"), "")
+
+ // remove empty lines after deleting the above-mentioned messages
+ stdout = strings.TrimSpace(stdout)
+ stderr = strings.TrimSpace(stderr)
return stdout + stderr, err
}