2017-09-27 11:16:18 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source ./test_helpers.sh
|
|
|
|
|
|
|
|
IPFS="../../main/ipfs --config /tmp/ipfs_1"
|
|
|
|
|
2017-09-27 12:02:00 +00:00
|
|
|
function check_failure() {
|
|
|
|
FUNC=$1;
|
|
|
|
RESULT=$2;
|
|
|
|
if [ $RESULT -eq 0 ]; then
|
|
|
|
echo "";
|
|
|
|
else
|
|
|
|
echo "Failure in $FUNC. The return value was $RESULT";
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-09-27 11:16:18 +00:00
|
|
|
function pre {
|
|
|
|
eval "$IPFS" init;
|
2017-09-27 12:02:00 +00:00
|
|
|
check_failure "pre" $?
|
2017-09-27 11:16:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function post {
|
|
|
|
rm -Rf /tmp/ipfs_1;
|
|
|
|
rm hello.txt;
|
|
|
|
}
|
|
|
|
|
|
|
|
function body {
|
|
|
|
create_hello_world;
|
|
|
|
eval "$IPFS" add hello.txt
|
2017-09-27 12:02:00 +00:00
|
|
|
eval "$IPFS" cat QmYAXgX8ARiriupMQsbGXtKdDyGzWry1YV3sycKw1qqmgH
|
2017-09-27 11:16:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|