From 762a173c7f7d2e6adda10fbe1eaa50a1ba503d29 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 16 Nov 2018 16:09:25 -0800 Subject: [PATCH] command: Fix TestRefresh_outPath We now only create a backup state file if the given output file already exists, which it does not in this test. (The behavior of creating the backup files is already covered by other tests, so no need for this one go out of its way to do it.) --- command/refresh_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/command/refresh_test.go b/command/refresh_test.go index 84808f174..843cd213d 100644 --- a/command/refresh_test.go +++ b/command/refresh_test.go @@ -343,11 +343,11 @@ func TestRefresh_outPath(t *testing.T) { t.Fatalf("wrong new object\ngot: %swant: %s", spew.Sdump(actual), spew.Sdump(expected)) } - backupState := testStateRead(t, outPath+DefaultBackupExtension) - actualStr := strings.TrimSpace(backupState.String()) - expectedStr := strings.TrimSpace(state.String()) - if actualStr != expectedStr { - t.Fatalf("bad:\n\n%s\n\n%s", actualStr, expectedStr) + if _, err := os.Stat(outPath+DefaultBackupExtension); !os.IsNotExist(err) { + if err != nil { + t.Fatalf("failed to test for backup file: %s", err) + } + t.Fatalf("backup file exists, but it should not because output file did not initially exist") } }