Skip to content

Commit

Permalink
test: cat test actual output
Browse files Browse the repository at this point in the history
  • Loading branch information
jbenet committed Nov 18, 2014
1 parent 493e5d3 commit 088016c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/t0040-add-and-cat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ test_expect_success "ipfs add bigfile output looks good" '
'

test_expect_success "ipfs cat succeeds" '
ipfs cat $HASH | shasum >sha1_actual
ipfs cat $HASH >actual &&
cat actual | shasum >sha1_actual
'

test_expect_success "ipfs cat output looks good" '
test_cmp mountdir/bigfile actual
'

test_expect_success "ipfs cat output shasum looks good" '
echo "885b197b01e0f7ff584458dc236cb9477d2e736d -" >sha1_expected &&
test_cmp sha1_expected sha1_actual
'
Expand Down

3 comments on commit 088016c

@chriscool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought that it would be wasteful to write another 100M file on disk and then compare it with another one, when we could just use shasum on both and compare the sums.
(Also "ipfs cat succeeds" was already tested above on a small file.)

Nit pick: now if you compare both files without using shasum, maybe using shasum again on "actual" is not needed. (It is used before on mountdir/bigfile.)

@chriscool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also below your changes there is:

test_expect_success FUSE "cat ipfs/bigfile succeeds" '
cat ipfs/$HASH | shasum >sha1_actual
'

If we don't care about writing another 100M file and compare with the original, we should probably do it there too.

@jbenet
Copy link
Member Author

@jbenet jbenet commented on 088016c Nov 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that it would be wasteful to write another 100M file on disk

Yeah it is wasteful. I added it because i was debugging an error (i wanted to see what the files looked like). I think maybe the right thing is to have it commented out (or skipped by default)

And, @chriscool, you tests have saved the world multiple times :) 👍

Please sign in to comment.