From cecd35b0efa21dc64a384e1dc8b93a38af34d0ae Mon Sep 17 00:00:00 2001 From: Dan McArdle Date: Sun, 4 Aug 2024 20:28:46 -0400 Subject: [PATCH] cmd/gitannex: Simplify verbose failures in tests --- cmd/gitannex/e2e_test.go | 4 +--- cmd/gitannex/gitannex_test.go | 25 +++++-------------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/cmd/gitannex/e2e_test.go b/cmd/gitannex/e2e_test.go index eae2b8e94..a67e9b259 100644 --- a/cmd/gitannex/e2e_test.go +++ b/cmd/gitannex/e2e_test.go @@ -31,9 +31,7 @@ func checkRcloneBinaryVersion(t *testing.T) error { cmd := exec.Command("rclone", "rc", "--loopback", "core/version") stdout, err := cmd.Output() - if err != nil { - return fmt.Errorf("failed to get rclone version: %w", err) - } + require.NoError(t, err) var parsed versionInfo if err := json.Unmarshal(stdout, &parsed); err != nil { diff --git a/cmd/gitannex/gitannex_test.go b/cmd/gitannex/gitannex_test.go index 6d60e1db1..9f3f08682 100644 --- a/cmd/gitannex/gitannex_test.go +++ b/cmd/gitannex/gitannex_test.go @@ -456,10 +456,7 @@ var fstestTestCases = []testCase{ h.requireWriteLine("EXTENSIONS INFO") // Advertise that we support the INFO extension h.requireReadLineExact("EXTENSIONS") - if !h.server.extensionInfo { - t.Errorf("expected INFO extension to be enabled") - return - } + require.True(t, h.server.extensionInfo) h.requireWriteLine("PREPARE") h.requireReadLineExact("GETCONFIG rcloneremotename") @@ -484,10 +481,7 @@ var fstestTestCases = []testCase{ h.requireWriteLine("EXTENSIONS INFO") // Advertise that we support the INFO extension h.requireReadLineExact("EXTENSIONS") - if !h.server.extensionInfo { - t.Errorf("expected INFO extension to be enabled") - return - } + require.True(t, h.server.extensionInfo) h.requireWriteLine("PREPARE") h.requireReadLineExact("GETCONFIG rcloneremotename") @@ -516,10 +510,7 @@ var fstestTestCases = []testCase{ h.requireWriteLine("EXTENSIONS INFO") // Advertise that we support the INFO extension h.requireReadLineExact("EXTENSIONS") - if !h.server.extensionInfo { - t.Errorf("expected INFO extension to be enabled") - return - } + require.True(t, h.server.extensionInfo) h.requireWriteLine("PREPARE") h.requireReadLineExact("GETCONFIG rcloneremotename") @@ -552,10 +543,7 @@ var fstestTestCases = []testCase{ h.requireWriteLine("EXTENSIONS INFO") // Advertise that we support the INFO extension h.requireReadLineExact("EXTENSIONS") - if !h.server.extensionInfo { - t.Errorf("expected INFO extension to be enabled") - return - } + require.True(t, h.server.extensionInfo) h.requireWriteLine("PREPARE") h.requireReadLineExact("GETCONFIG rcloneremotename") @@ -584,10 +572,7 @@ var fstestTestCases = []testCase{ h.requireWriteLine("EXTENSIONS INFO") // Advertise that we support the INFO extension h.requireReadLineExact("EXTENSIONS") - if !h.server.extensionInfo { - t.Errorf("expected INFO extension to be enabled") - return - } + require.True(t, h.server.extensionInfo) h.requireWriteLine("PREPARE") h.requireReadLineExact("GETCONFIG rcloneremotename")