Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
document testDagSync function
Browse files Browse the repository at this point in the history
  • Loading branch information
kjzz authored and schomatis committed Oct 29, 2018
1 parent f573b7b commit e8af7a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mod/dagmodifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ func testDagTruncate(t *testing.T, opts testu.NodeOpts) {
}
}

// TestDagSync tests that a DAG will expand sparse during sync
// if offset > curNode's size.
func TestDagSync(t *testing.T) {
dserv := testu.GetDAGServ()
nd := dag.NodeWithData(unixfs.FilePBData(nil, 0))
Expand All @@ -434,6 +436,7 @@ func TestDagSync(t *testing.T) {
t.Fatal(err)
}

// Truncate leave the offset at 5 and filesize at 0
err = dagmod.Truncate(0)
if err != nil {
t.Fatal(err)
Expand All @@ -444,6 +447,7 @@ func TestDagSync(t *testing.T) {
t.Fatal(err)
}

// When Offset > filesize , Sync will call enpandSparse
err = dagmod.Sync()
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit e8af7a6

Please sign in to comment.