From 86552cf3ae0973608ef46da106147ca7752cbbb0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 17 May 2022 18:46:48 +0300 Subject: [PATCH] engine: make `corruptSubDir` to ignore `blobovnicza` dir There is a dir for Blobovnicza tree in BlobStor, so we need to ignore it. Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/engine/error_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/local_object_storage/engine/error_test.go b/pkg/local_object_storage/engine/error_test.go index 4f53a1df..12bdbb6c 100644 --- a/pkg/local_object_storage/engine/error_test.go +++ b/pkg/local_object_storage/engine/error_test.go @@ -197,12 +197,16 @@ func checkShardState(t *testing.T, e *StorageEngine, id *shard.ID, errCount uint require.Equal(t, errCount, sh.errorCount.Load()) } -// corruptSubDir makes random directory in blobstor FSTree unreadable. +// corruptSubDir makes random directory except "blobovnicza" in blobstor FSTree unreadable. func corruptSubDir(t *testing.T, dir string) { de, err := os.ReadDir(dir) require.NoError(t, err) + + // FIXME(@cthulhu-rider): copy-paste of unexported const from blobstor package, see #1407 + const dirBlobovnicza = "blobovnicza" + for i := range de { - if de[i].IsDir() { + if de[i].IsDir() && de[i].Name() != dirBlobovnicza { require.NoError(t, os.Chmod(filepath.Join(dir, de[i].Name()), 0)) return }