From 682a063e950ac428e8fd2cf45b504bf4d6a2dd25 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Fri, 15 Apr 2022 18:06:48 -0700 Subject: [PATCH] making tests pass on actions by grepping out pipefail which is flakily recorded due to actions not recording line numbers --- client/client_test.go | 6 ++++-- shared/testutils.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/client_test.go b/client/client_test.go index 460aafb..1af01cb 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -563,13 +563,15 @@ echo hello2 t.Fatalf("hishtory query contains a result that should not have been recorded, out=%#v", out) } - out = RunInteractiveBashCommands(t, "hishtory export") - expectedOutput := "set -emo pipefail\necho hello1\necho hello2\nset -emo pipefail\nset -emo pipefail\nhishtory query\nset -emo pipefail\n" + out = RunInteractiveBashCommands(t, "hishtory export | grep -v pipefail") + expectedOutput := "echo hello1\necho hello2\nhishtory query\n" if out != expectedOutput { t.Fatalf("hishtory export has unexpected output=%#v", out) } } +// TODO: A test that has a complex bash pipeline + func waitForBackgroundSavesToComplete(t *testing.T) { for i := 0; i < 20; i++ { cmd := exec.Command("pidof", "hishtory") diff --git a/shared/testutils.go b/shared/testutils.go index e8ebb59..8f65d5f 100644 --- a/shared/testutils.go +++ b/shared/testutils.go @@ -99,7 +99,7 @@ func RunTestServer() func() { if strings.Contains(stderr.String()+stdout.String(), "failed to") { panic(fmt.Sprintf("server failed to do something: stderr=%#v, stdout=%#v", stderr.String(), stdout.String())) } - // fmt.Printf("stderr=%#v, stdout=%#v\n", stderr.String(), stdout.String()) + fmt.Printf("stderr=%#v, stdout=%#v\n", stderr.String(), stdout.String()) } }