Skip to content

Instantly share code, notes, and snippets.

@chriscool
Created November 12, 2014 07:20
Show Gist options
  • Save chriscool/5790af7a8a55dc244356 to your computer and use it in GitHub Desktop.
Save chriscool/5790af7a8a55dc244356 to your computer and use it in GitHub Desktop.
Test for ipfs name resolution
#!/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
'
test_expect_success "'ipns name resolve' succeeds" '
HASH2=$(cut -d \ -f 3 actual) &&
ipfs name resolve $HASH2 >published
'
test_expect_success "'ipns name resolve' output looks good" '
test_cmp published hash
'
test_done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment