-
-
Save chriscool/454101c5aa359bdd63be to your computer and use it in GitHub Desktop.
#!/bin/sh | |
# | |
# Copyright (c) 2014 Jeromy Johnson | |
# MIT Licensed; see the LICENSE file in this repository. | |
# | |
test_description="test ipns name resolution" | |
. lib/test-lib.sh | |
test_expect_success "ipfs init succeeds" ' | |
export IPFS_DIR="$(pwd)/.go-ipfs" && | |
ipfs init -b 1024 | |
' | |
test_expect_success "'ipns name publish' succeeds" ' | |
HASH="QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o" && | |
echo $HASH > hash && | |
ipfs name publish $HASH > actual | |
' | |
test_expect_success "'ipns name publish' output looks good" ' | |
egrep "published name .* to $HASH" actual | |
' | |
echo "actual:" | |
cat actual | |
HASH2=$(cut -d \ -f 3 actual) | |
echo "HASH2: $HASH2" | |
ipfs name resolve $HASH2 >published | |
echo "result from ipfs name resolve $HASH2: $?" | |
echo "published:" | |
cat published | |
echo "hash:" | |
cat hash | |
exit 1 |
Could you try the following at the end of the script, it just adds a "sleep 5" before the "ipfs name resolve":
echo "actual:"
cat actual
HASH2=$(cut -d \ -f 3 actual)
echo "HASH2: $HASH2"
sleep 5
ipfs name resolve $HASH2 >published
echo "result from ipfs name resolve
echo "published:"
cat published
echo "hash:"
cat hash
I get the same output
What about with "sleep 30"?
Also what happens if you manually do the following after the end of the script:
$ cd trash\ directory.t0060-names.sh/
$ ipfs name resolve $HASH2
you will need to replace $HASH2 above with the value from the script output
The issue with doing that, is if i run those commands, ill be running them using my users ipfs dir, and if the script does it, then it uses the scripts ipfsdir
Yeah you need 'export IPFS_DIR="$(pwd)/.go-ipfs"' after the cd.
That is:
$ cd trash\ directory.t0060-names.sh/
$ export IPFS_DIR="$(pwd)/.go-ipfs"
$ ipfs name resolve $HASH2
On my machine I get:
$ ./t0060-names.sh
ok 1 - ipfs init succeeds
ok 2 - 'ipns name publish' succeeds
ok 3 - 'ipns name publish' output looks good
actual:
published name Qmf41JbUWzPHQJZhDbAuZBnGBk9wg8AR4ZZiwyHxGC1Shn to QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
HASH2: Qmf41JbUWzPHQJZhDbAuZBnGBk9wg8AR4ZZiwyHxGC1Shn
result from ipfs name resolve Qmf41JbUWzPHQJZhDbAuZBnGBk9wg8AR4ZZiwyHxGC1Shn: 0
published:
QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
hash:
QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
FATAL: Unexpected exit with code 1