From 98a1c44489d7ffc0a4c9cd67365c6d0270ad4c19 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 12 Jun 2018 14:50:33 -0700 Subject: [PATCH] test swarm connect/disconnect License: MIT Signed-off-by: Steven Allen --- test/sharness/t0140-swarm.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/sharness/t0140-swarm.sh b/test/sharness/t0140-swarm.sh index 121240621..b9a215de5 100755 --- a/test/sharness/t0140-swarm.sh +++ b/test/sharness/t0140-swarm.sh @@ -97,4 +97,26 @@ test_expect_success "Addresses.NoAnnounce with /ipcidr affects addresses" ' test_kill_ipfs_daemon +test_expect_success "set up tcp testbed" ' + iptb init -n 2 -p 0 -f --bootstrap=none +' + +startup_cluster 2 + +test_expect_success "disconnect work without specifying a transport address" ' + [ $(ipfsi 0 swarm peers | wc -l) -eq 1 ] && + ipfsi 0 swarm disconnect "/ipfs/$(iptb get id 1)" && + [ $(ipfsi 0 swarm peers | wc -l) -eq 0 ] +' + +test_expect_success "connect work without specifying a transport address" ' + [ $(ipfsi 0 swarm peers | wc -l) -eq 0 ] && + ipfsi 0 swarm connect "/ipfs/$(iptb get id 1)" && + [ $(ipfsi 0 swarm peers | wc -l) -eq 1 ] +' + +test_expect_success "stopping cluster" ' + iptb stop +' + test_done