2017-09-27 10:52:53 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-10-04 11:34:37 +00:00
|
|
|
####
|
2017-10-05 16:20:12 +00:00
|
|
|
# Attempt to retrieve large binary file from running daemon
|
2017-10-04 11:34:37 +00:00
|
|
|
#
|
|
|
|
####
|
|
|
|
|
|
|
|
source ./test_helpers.sh
|
|
|
|
|
|
|
|
IPFS="../../main/ipfs --config /tmp/ipfs_1"
|
|
|
|
|
2017-09-27 10:52:53 +00:00
|
|
|
function pre {
|
2017-10-04 11:34:37 +00:00
|
|
|
rm -Rf /tmp/ipfs_1
|
|
|
|
eval "$IPFS" init;
|
2017-10-05 16:20:12 +00:00
|
|
|
check_failure_with_exit "pre" $?
|
2017-10-04 11:34:37 +00:00
|
|
|
cp ../config.test1.wo_journal /tmp/ipfs_1/config
|
2017-09-27 10:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function post {
|
2017-10-04 11:34:37 +00:00
|
|
|
rm -Rf /tmp/ipfs_1;
|
2017-10-04 13:42:00 +00:00
|
|
|
rm hello.bin;
|
|
|
|
rm hello2.bin;
|
2017-09-27 10:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function body {
|
2017-10-05 18:08:36 +00:00
|
|
|
retVal=0
|
|
|
|
create_binary_file 512000;
|
2017-10-04 11:34:37 +00:00
|
|
|
eval "$IPFS" add hello.bin
|
2017-10-05 16:20:12 +00:00
|
|
|
check_failure_with_exit "add hello.bin" $?
|
2017-10-04 11:34:37 +00:00
|
|
|
|
|
|
|
#start the daemon
|
|
|
|
eval "../../main/ipfs --config /tmp/ipfs_1 daemon &"
|
|
|
|
daemon_id=$!
|
|
|
|
sleep 5
|
|
|
|
|
2017-10-05 16:20:12 +00:00
|
|
|
eval "$IPFS" cat QmVGA3bXDJ41xoT621xQNzQgtBMQHj2AYxaunLBJtSoNgg > hello2.bin
|
2017-10-05 18:08:36 +00:00
|
|
|
check_failure "cat" $?
|
2017-10-04 11:34:37 +00:00
|
|
|
|
2017-10-05 16:20:12 +00:00
|
|
|
# file size should be 512
|
2017-10-04 13:42:00 +00:00
|
|
|
actualsize=$(wc -c < hello2.bin)
|
2017-10-05 16:20:12 +00:00
|
|
|
if [ $actualsize -ne 512 ]; then
|
2017-10-04 13:42:00 +00:00
|
|
|
echo '*** Failure *** file size incorrect'
|
2017-10-05 18:08:36 +00:00
|
|
|
let retVal=1
|
2017-10-04 13:42:00 +00:00
|
|
|
fi
|
|
|
|
|
2017-10-04 11:34:37 +00:00
|
|
|
kill -9 $daemon_id
|
2017-10-05 18:08:36 +00:00
|
|
|
exit $retVal
|
2017-09-27 10:52:53 +00:00
|
|
|
}
|