From: Matt Joiner Date: Wed, 4 Jun 2025 01:07:03 +0000 (+1000) Subject: Tweaks to Sintel fs test X-Git-Tag: v1.59.0~77 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=7c29c120a504ee845fad568fbc32e8bb9795b0de;p=btrtrc.git Tweaks to Sintel fs test --- diff --git a/fs/stream-sintel_test.go b/fs/stream-sintel_test.go index 3db62294..3f780234 100644 --- a/fs/stream-sintel_test.go +++ b/fs/stream-sintel_test.go @@ -43,8 +43,13 @@ func copyFile(src, dst string) (err error) { } func TestStreamSintelMagnet(t *testing.T) { + fileHashes := map[string]string{ + "poster.jpg": "f9223791908131c505d7bdafa7a8aaf5", + "Sintel.mp4": "083e808d56aa7b146f513b3458658292", + } + targetFile := "Sintel.mp4" if testing.Short() { - t.Skip("skipping test in short mode") + targetFile = "poster.jpg" } dir := t.TempDir() t.Logf("temp dir: %v", dir) @@ -99,7 +104,7 @@ func TestStreamSintelMagnet(t *testing.T) { panicif.Err(err) }() - f, err := openFileWhenExists(t, filepath.Join(mountDir, "Sintel", "Sintel.mp4")) + f, err := openFileWhenExists(t, filepath.Join(mountDir, "Sintel", targetFile)) panicif.Err(err) t.Logf("opened %v", f.Name()) t.Cleanup(func() { f.Close() }) @@ -117,12 +122,17 @@ func TestStreamSintelMagnet(t *testing.T) { }, } h := md5.New() + go func() { + <-t.Context().Done() + t.Log("testing context done") + f.Close() + }() _, err = f.WriteTo(io.MultiWriter(h, &w)) panicif.Err(err) err = f.Close() panicif.Err(err) - qt.Assert(t, qt.Equals(hex.EncodeToString(h.Sum(nil)), "083e808d56aa7b146f513b3458658292")) + qt.Assert(t, qt.Equals(hex.EncodeToString(h.Sum(nil)), fileHashes[targetFile])) err = fuse.Unmount(mountDir) panicif.Err(err)