From e8af7a6b5b5588835fb856e35024d9163361c7ab Mon Sep 17 00:00:00 2001 From: Kejie Zhang Date: Wed, 24 Oct 2018 21:34:44 +0800 Subject: [PATCH] document testDagSync function --- mod/dagmodifier_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mod/dagmodifier_test.go b/mod/dagmodifier_test.go index 1e192e720..b61369362 100644 --- a/mod/dagmodifier_test.go +++ b/mod/dagmodifier_test.go @@ -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)) @@ -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) @@ -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)