Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 64b69a0

Browse files
committed
testing: check MFS testdata CID in TestMain
1 parent 46bd524 commit 64b69a0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

mfs_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ func TestMain(m *testing.M) {
2828
}
2929
}
3030

31+
stat, err := s.FilesStat(context.Background(), "/testdata")
32+
if err != nil {
33+
fmt.Fprintf(os.Stderr, "Failed to stat test data, not running tests: %v\n", err)
34+
os.Exit(1)
35+
}
36+
37+
expectedTestdataCIDString := "QmfZtacPc5nch976ZsiBw6nhLmTzy5JjW2pzZg8j7GjqWq"
38+
if stat.Hash != expectedTestdataCIDString {
39+
fmt.Fprintf(os.Stderr, "CID of /testdata is %s which does not match the expected %s, not running tests: %v\n", stat.Hash, expectedTestdataCIDString, err)
40+
os.Exit(1)
41+
}
42+
3143
exitVal := m.Run()
3244
if err := s.FilesRm(context.Background(), "/testdata", true); err != nil {
3345
fmt.Fprintf(os.Stderr, "Failed to remove test data: %v\n", err)

0 commit comments

Comments
 (0)