Skip to content

Commit

Permalink
ipld/unixfs/trickle: add Parallel to tests
Browse files Browse the repository at this point in the history
They don't share state, on my computer time to test went down from 20s to 10s with ~200% CPU usage.
  • Loading branch information
Jorropo committed Jan 12, 2024
1 parent ba2f544 commit 651402f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ipld/unixfs/importer/trickle/trickle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ const (
)

func runBothSubtests(t *testing.T, tfunc func(*testing.T, UseRawLeaves)) {
t.Run("leaves=ProtoBuf", func(t *testing.T) { tfunc(t, ProtoBufLeaves) })
t.Run("leaves=Raw", func(t *testing.T) { tfunc(t, RawLeaves) })
t.Parallel()

t.Run("leaves=ProtoBuf", func(t *testing.T) { t.Parallel(); tfunc(t, ProtoBufLeaves) })
t.Run("leaves=Raw", func(t *testing.T) { t.Parallel(); tfunc(t, RawLeaves) })
}

func buildTestDag(ds ipld.DAGService, spl chunker.Splitter, rawLeaves UseRawLeaves) (*merkledag.ProtoNode, error) {
Expand Down Expand Up @@ -611,6 +613,8 @@ func testMultipleAppends(t *testing.T, rawLeaves UseRawLeaves) {
}

func TestAppendSingleBytesToEmpty(t *testing.T) {
t.Parallel()

ds := mdtest.Mock()

data := []byte("AB")
Expand Down

0 comments on commit 651402f

Please sign in to comment.