From 325edd2229f14346fa25e6e4d978aa2f98c14d8a Mon Sep 17 00:00:00 2001 From: chaitalisg Date: Tue, 26 Apr 2022 17:13:31 -0700 Subject: [PATCH] test(general): Ignore directory size check before and after restore (#1904) --- tests/tools/fswalker/fswalker.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tests/tools/fswalker/fswalker.go b/tests/tools/fswalker/fswalker.go index 0b47eb80a..69e6ce1db 100644 --- a/tests/tools/fswalker/fswalker.go +++ b/tests/tools/fswalker/fswalker.go @@ -35,7 +35,7 @@ func NewWalkCompare() *WalkCompare { GlobalFilterFuncs: []func(string, fswalker.ActionData) bool{ filterFileTimeDiffs, isRootDirectoryRename, - dirSizeMightBeOffByBlockSizeMultiple, + filterDirSizeCheck, ignoreGIDIfZero, ignoreUIDIfZero, }, @@ -186,18 +186,10 @@ func isRootDirectoryRename(diffItem string, mod fswalker.ActionData) bool { return mod.Before.Info.IsDir && filepath.Clean(mod.Before.Path) == "." } -func dirSizeMightBeOffByBlockSizeMultiple(str string, mod fswalker.ActionData) bool { - if !mod.Before.Info.IsDir { - return false - } - - if !strings.Contains(str, "size: ") { - return false - } - - const blockSize = 4096 - - return (mod.Before.Stat.Size-mod.After.Stat.Size)%blockSize == 0 +// Directory size changes with underlying file system setups. Ignote the dir size during data consistency check to make it robust. +// Remove this filter from GlobalFilterFuncs to detect the size difference in a directory. +func filterDirSizeCheck(str string, mod fswalker.ActionData) bool { + return mod.Before.Info.IsDir && strings.Contains(str, "size: ") } func filterFileTimeDiffs(str string, mod fswalker.ActionData) bool {