1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-25 02:16:56 +08:00
Files
kubo/test/t0040-add-and-cat.sh
Juan Batiz-Benet 842de46ccf test: moved installed things into own dirs
I moved installed things into own dirs bin and lib.

@chriscool sorry to move things around again, the top level
test dir was getting a bit clutterd.
2014-11-08 20:12:02 -08:00

85 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
test_description="Test add and cat commands"
. lib/test-lib.sh
test_launch_ipfs_mount
test_expect_success "ipfs add succeeds" '
echo "Hello Worlds!" >mountdir/hello.txt &&
ipfs add mountdir/hello.txt >actual
'
test_expect_success "ipfs add output looks good" '
HASH="QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH" &&
echo "added $HASH $(pwd)/mountdir/hello.txt" >expected &&
test_cmp expected actual
'
test_expect_success "ipfs cat succeeds" '
ipfs cat $HASH >actual
'
test_expect_success "ipfs cat output looks good" '
echo "Hello Worlds!" >expected &&
test_cmp expected actual
'
test_expect_success FUSE "cat ipfs/stuff succeeds" '
cat ipfs/$HASH >actual
'
test_expect_success FUSE "cat ipfs/stuff looks good" '
test_cmp expected actual
'
test_expect_success "go-random is installed" '
type random
'
test_expect_success "generate 100MB file using go-random" '
random 104857600 42 >mountdir/bigfile
'
test_expect_success "sha1 of the file looks ok" '
echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 mountdir/bigfile" >sha1_expected &&
shasum mountdir/bigfile >sha1_actual &&
test_cmp sha1_expected sha1_actual
'
test_expect_success "ipfs add bigfile succeeds" '
ipfs add mountdir/bigfile >actual
'
test_expect_success "ipfs add bigfile output looks good" '
HASH="QmeZVkWkDu4W1vxWdDgUbqKYba9K3u45hJEdPA4Wr2sHZz" &&
echo "added $HASH $(pwd)/mountdir/bigfile" >expected &&
test_cmp expected actual
'
test_expect_success "ipfs cat succeeds" '
ipfs cat $HASH | shasum >sha1_actual
'
test_expect_success "ipfs cat output looks good" '
echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 -" >sha1_expected &&
test_cmp sha1_expected sha1_actual
'
test_expect_success FUSE "cat ipfs/bigfile succeeds" '
cat ipfs/$HASH | shasum >sha1_actual
'
test_expect_success FUSE "cat ipfs/bigfile looks good" '
test_cmp sha1_expected sha1_actual
'
test_kill_ipfs_mount
test_done