Skip to content

Commit

Permalink
Less aggressive erroring and better tests.
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
  • Loading branch information
hackergrrl committed May 14, 2016
1 parent fdbd56b commit e50dfa1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
5 changes: 3 additions & 2 deletions mfs/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (d *Directory) AddChild(name string, nd *dag.Node) error {

pbn, err := ft.FromBytes(nd.Data)
if err != nil {
log.Error("IPNS pointer was not unixfs node")
log.Warning("child was not unixfs node")
return err
}

Expand All @@ -356,7 +356,8 @@ func (d *Directory) AddChild(name string, nd *dag.Node) error {
}
d.files[name] = nfi
default:
panic("unrecognized! (NYI)")
log.Error("unrecognized mfs dag node type: ", pbn.GetType())
return ErrInvalidChild
}

return nil
Expand Down
23 changes: 15 additions & 8 deletions test/sharness/t0250-files-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,23 @@ test_files_api() {
'

# test for https://github.com/ipfs/go-ipfs/issues/2654
ipfs files mkdir /test_dir
ipfs files rm -r "/test_dir"
echo "content" | ipfs files write -e "/test_file"
ipfs files cp "/test_file" "/test_dir"
test_expect_success "create and remove dir" '
ipfs files mkdir /test_dir &&
ipfs files rm -r "/test_dir"
'
test_expect_success "create test file" '
echo "content" | ipfs files write -e "/test_file"
'
test_expect_success "copy test file onto test dir" '
ipfs files cp "/test_file" "/test_dir"
'
test_expect_success "test /test_dir" '
ipfs files stat "/test_dir"
ipfs files read "/test_dir"
ipfs files stat "/test_dir" | grep -q "^Type: file"
'
test_expect_success "clean up /test_dir and /test_file" '
ipfs files rm -r /test_dir &&
ipfs files rm -r /test_file
'
ipfs files rm -r /test_dir
ipfs files rm -r /test_file
}

# test offline and online
Expand Down

0 comments on commit e50dfa1

Please sign in to comment.