Skip to content

Instantly share code, notes, and snippets.

@chriscool
Created November 12, 2014 21:42
Show Gist options
  • Save chriscool/454101c5aa359bdd63be to your computer and use it in GitHub Desktop.
Save chriscool/454101c5aa359bdd63be to your computer and use it in GitHub Desktop.
Test for ipfs name resolution with debug commands
#!/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
@whyrusleeping
Copy link

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

@chriscool
Copy link
Author

Yeah you need 'export IPFS_DIR="$(pwd)/.go-ipfs"' after the cd.

@chriscool
Copy link
Author

That is:

$ cd trash\ directory.t0060-names.sh/
$ export IPFS_DIR="$(pwd)/.go-ipfs"
$ ipfs name resolve $HASH2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment