t0140-swarm.sh 879 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/bin/sh
#
# Copyright (c) 2014 Jeromy Johnson
# MIT Licensed; see the LICENSE file in this repository.
#

test_description="Test ipfs swarm command"

. lib/test-lib.sh

test_init_ipfs

test_launch_ipfs_daemon

test_expect_success 'disconnected: peers is empty' '
	ipfs swarm peers >actual &&
	test_must_be_empty actual
'

test_expect_success 'disconnected: addrs local has localhost' '
	ipfs swarm addrs local >actual &&
	grep "/ip4/127.0.0.1" actual
'

test_expect_success 'disconnected: addrs local matches ipfs id' '
	ipfs id -f="<addrs>\\n" | sort >expected &&
	ipfs swarm addrs local --id | sort >actual &&
	test_cmp expected actual
'

31 32 33 34 35 36 37 38 39 40
test_expect_success "ipfs id self works" '
	myid=$(ipfs id -f="<id>") &&
	ipfs id --timeout=1s $myid > output
'

test_expect_success "output looks good" '
	grep $myid output &&
	grep PublicKey output
'

41 42 43
test_kill_ipfs_daemon

test_done