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

Commit

Permalink
testing: check MFS testdata CID in TestMain
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Sep 17, 2021
1 parent 46bd524 commit 4b23360
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ func TestMain(m *testing.M) {
}
}

stat, err := s.FilesStat(context.Background(), "/testdata")
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to stat test data, not running tests: %v\n", err)
os.Exit(1)
}

expectedTestdataCIDString := "QmfZtacPc5nch976ZsiBw6nhLmTzy5JjW2pzZg8j7GjqWe"
if stat.Hash != expectedTestdataCIDString {
fmt.Fprintf(os.Stderr, "CID of /testdata is %s which does not match the expected %s, not running tests\n", stat.Hash, expectedTestdataCIDString)
os.Exit(1)
}

exitVal := m.Run()
if err := s.FilesRm(context.Background(), "/testdata", true); err != nil {
fmt.Fprintf(os.Stderr, "Failed to remove test data: %v\n", err)
Expand Down

0 comments on commit 4b23360

Please sign in to comment.