From 4fceaa31104271a6041c8247beef83fc5cf0e771 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Wed, 21 Sep 2022 19:58:10 -0700 Subject: [PATCH] Run tests without CGO since that is how prod is built + fix broken tests from previous commit --- client/client_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/client_test.go b/client/client_test.go index 4ab0108..6b6e541 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -27,6 +27,8 @@ import ( func TestMain(m *testing.M) { defer shared.RunTestServer()() cmd := exec.Command("go", "build", "-o", "/tmp/client") + cmd.Env = os.Environ() + cmd.Env = append(cmd.Env, "CGO_ENABLED=0") err := cmd.Run() if err != nil { panic(fmt.Sprintf("failed to build client: %v", err)) @@ -1365,7 +1367,7 @@ ls /tmp`, randomCmdUuid, randomCmdUuid) // Redact foo out = tester.RunInteractiveShell(t, `hishtory redact --force foo`) - if out != "Permanently deleting 2 entries" { + if out != "Permanently deleting 2 entries\n" { t.Fatalf("hishtory redact gave unexpected output=%#v", out) } @@ -1378,7 +1380,7 @@ ls /tmp`, randomCmdUuid, randomCmdUuid) // Redact s out = tester.RunInteractiveShell(t, `hishtory redact --force s`) - if out != "Permanently deleting 10 entries" { + if out != "Permanently deleting 10 entries\n" { t.Fatalf("hishtory redact gave unexpected output=%#v", out) } @@ -1426,7 +1428,7 @@ ls /tmp`, randomCmdUuid, randomCmdUuid) restoreInstall2 := shared.BackupAndRestoreWithId(t, "-2") restoreInstall1() out = tester.RunInteractiveShell(t, `hishtory redact --force `+randomCmdUuid) - if out != "Permanently deleting 2 entries" { + if out != "Permanently deleting 2 entries\n" { t.Fatalf("hishtory redact gave unexpected output=%#v", out) }