test: the store-down test finds copy-on-write side files under the volume's directory

A store now lives in its volume's own directory (<name>-<id8>) and its side
file is created next to it; the test globbed only the host root, so it
measured 0 and its no-leftover checks looked nowhere. It walks the root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-30 21:44:33 -08:00
1 parent c1fb211129
commit 4426d07ba4
1 file changed
+11 -4
@@ -7,6 +7,7 @@ import (
"context"
"errors"
"fmt"
"io/fs"
"os"
"path"
"path/filepath"
@@ -108,14 +109,20 @@ func storeDownDuringACut(t *testing.T, down string, cowBytes int64, cowWindow bo
}
return fmt.Sprintf("%s@%d", hd.Current, hd.Position)
}
// sideBytes sums the copy-on-write side files anywhere under the host's
// root: a store lives in its volume's own directory (<name>-<id8>), and
// its side file is created next to it.
sideBytes := func() int64 {
files, _ := filepath.Glob(filepath.Join(env.hosts["s1"].root, "*.cut-cow-*"))
var n int64
for _, f := range files {
if st, err := os.Stat(f); err == nil {
_ = filepath.WalkDir(env.hosts["s1"].root, func(p string, d fs.DirEntry, err error) error {
if err != nil || d.IsDir() || !strings.Contains(d.Name(), ".cut-cow-") {
return nil
}
if st, err := os.Stat(p); err == nil {
n += st.Size()
}
}
return nil
})
return n
}