diff --git a/fuse/ipns/ipns_test.go b/fuse/ipns/ipns_test.go index b35a584b7..330cde546 100644 --- a/fuse/ipns/ipns_test.go +++ b/fuse/ipns/ipns_test.go @@ -1,7 +1,9 @@ package ipns import ( + "bytes" "crypto/rand" + "io/ioutil" "os" "testing" @@ -29,6 +31,7 @@ func TestIpnsBasicIO(t *testing.T) { if err != nil { t.Fatal(err) } + defer mnt.Close() data := randBytes(12345) fi, err := os.Create(mnt.Dir + "/local/testfile") @@ -54,16 +57,14 @@ func TestIpnsBasicIO(t *testing.T) { t.Fatal(err) } - rbuf := make([]byte, len(data)) - n, err = fi.Read(rbuf) + rbuf, err := ioutil.ReadAll(fi) if err != nil { t.Fatal(err) } - - if n != len(rbuf) { - t.Fatal("Failed to read correct amount!") - } - fi.Close() + if !bytes.Equal(rbuf, data) { + t.Fatal("Incorrect Read!") + } + } diff --git a/fuse/ipns/ipns_unix.go b/fuse/ipns/ipns_unix.go index 5312d9fff..5b2bc8832 100644 --- a/fuse/ipns/ipns_unix.go +++ b/fuse/ipns/ipns_unix.go @@ -2,7 +2,6 @@ package ipns import ( "bytes" - "fmt" "io/ioutil" "os" "path/filepath" @@ -294,10 +293,6 @@ func (s *Node) ReadAll(intr fs.Intr) ([]byte, fuse.Error) { log.Error("[%s] Readall error: %s", s.name, err) return nil, err } - if len(b) > 4 { - log.Debug("ReadAll trailing bytes: %v", b[len(b)-4:]) - } - fmt.Println(b) return b, nil } @@ -342,7 +337,7 @@ func (n *Node) Flush(req *fuse.FlushRequest, intr fs.Intr) fuse.Error { } n.Nd = newNode - //TEMP + /*/TEMP dr, err := mdag.NewDagReader(n.Nd, n.Ipfs.DAG) if err != nil { log.Critical("Verification read failed.") @@ -355,7 +350,7 @@ func (n *Node) Flush(req *fuse.FlushRequest, intr fs.Intr) fuse.Error { fmt.Printf("READ %d BYTES\n", len(b)) fmt.Println(string(b)) fmt.Println(b) - // + //*/ n.writerBuf = nil