From 466abf138760b9f431b8d6204c7203059aded1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 1 Aug 2024 11:45:47 +0200 Subject: [PATCH] Shaman test: replace `assert.True(...)` with `assert.ErrorIs()` Replace `assert.True(t, errors.Is(err, errtype), ...)` with `assert.ErrorIs(t, err, errtype, ...)`. No functional changes to the test, except better failure reporting. --- pkg/shaman/cleanup_test.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/shaman/cleanup_test.go b/pkg/shaman/cleanup_test.go index a9fd3692..ce74fed1 100644 --- a/pkg/shaman/cleanup_test.go +++ b/pkg/shaman/cleanup_test.go @@ -23,7 +23,6 @@ package shaman import ( - "errors" "fmt" "io/fs" "os" @@ -199,7 +198,7 @@ func TestGCComponents(t *testing.T) { assert.FileExists(t, absPaths["6001.blob"], "file should exist after GC") assert.FileExists(t, absPaths["781.blob"], "file should exist after GC") _, err = os.Stat(absPaths["7488.blob"]) - assert.True(t, errors.Is(err, fs.ErrNotExist), "file %s should NOT exist after GC", absPaths["7488.blob"]) + assert.ErrorIs(t, err, fs.ErrNotExist, "file %s should NOT exist after GC", absPaths["7488.blob"]) } // Test of the high-level GCStorage() function. @@ -245,9 +244,9 @@ func TestGarbageCollect(t *testing.T) { assert.FileExists(t, absPaths["7488.blob"], "file should exist after dry-run GC") server.GCStorage(false) _, err = os.Stat(absPaths["6001.blob"]) - assert.True(t, errors.Is(err, fs.ErrNotExist), "file %s should NOT exist after GC", absPaths["6001.blob"]) + assert.ErrorIs(t, err, fs.ErrNotExist, "file %s should NOT exist after GC", absPaths["6001.blob"]) _, err = os.Stat(absPaths["7488.blob"]) - assert.True(t, errors.Is(err, fs.ErrNotExist), "file %s should NOT exist after GC", absPaths["7488.blob"]) + assert.ErrorIs(t, err, fs.ErrNotExist, "file %s should NOT exist after GC", absPaths["7488.blob"]) // Used files should still exist. assert.FileExists(t, absPaths["781.blob"])