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.
This commit is contained in:
parent
3b6102fe3a
commit
466abf1387
@ -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"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user