Skip to content

Commit

Permalink
Update IPTB test - WIP
Browse files Browse the repository at this point in the history
Related to #5521
  • Loading branch information
Travis Person committed Oct 23, 2018
1 parent dd4d8bb commit 498dbee
Show file tree
Hide file tree
Showing 23 changed files with 85 additions and 80 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"version": "0.1.3"
},
{
"hash": "QmbBkvKTxnM5xR9u2KDxQXfGzABq6FWsnuCj4raDFFHphf",
"hash": "QmU5w6sBozzDcfHXuKn1ZZAYuBw1rE57YYRVxgUcCjEX8C",
"name": "iptb",
"version": "1.3.16"
"version": "2.0.0"
},
{
"hash": "QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8",
Expand Down
6 changes: 5 additions & 1 deletion test/bin/Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ $(d)/go-timeout: test/dependencies/go-timeout
$(go-build)
TGTS_$(d) += $(d)/go-timeout

$(d)/iptb: test/dependencies/iptb
$(go-build)
TGTS_$(d) += $(d)/iptb

$(d)/ma-pipe-unidir: test/dependencies/ma-pipe-unidir
$(go-build)
TGTS_$(d) += $(d)/ma-pipe-unidir

TGTS_GX_$(d) := hang-fds iptb
TGTS_GX_$(d) := hang-fds
TGTS_GX_$(d) := $(addprefix $(d)/,$(TGTS_GX_$(d)))

$(TGTS_GX_$(d)):
Expand Down
10 changes: 5 additions & 5 deletions test/sharness/lib/iptb-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export IPTB_ROOT="$(pwd)/.iptb"
ipfsi() {
dir="$1"
shift
IPFS_PATH="$IPTB_ROOT/$dir" ipfs "$@"
IPFS_PATH="$IPTB_ROOT/testbeds/default/$dir" ipfs "$@"
}

check_has_connection() {
Expand All @@ -21,7 +21,7 @@ iptb() {
if ! command iptb "$@"; then
case "$1" in
start|stop|connect)
test_fsh command iptb logs '*'
test_fsh command iptb logs
;;
esac
return 1
Expand All @@ -36,11 +36,11 @@ startup_cluster() {

if test -n "$other_args"; then
test_expect_success "start up nodes with additional args" "
iptb start --args \"${other_args[@]}\"
iptb start -wait -- ${other_args[@]}
"
else
test_expect_success "start up nodes" '
iptb start
iptb start -wait
'
fi

Expand All @@ -58,7 +58,7 @@ startup_cluster() {
}

iptb_wait_stop() {
while ! iptb for-each sh -c '! { test -e "$IPFS_PATH/repo.lock" && fuser -f "$IPFS_PATH/repo.lock" >/dev/null; }'; do
while ! iptb run -- sh -c '! { test -e "$IPFS_PATH/repo.lock" && fuser -f "$IPFS_PATH/repo.lock" >/dev/null; }'; do
go-sleep 10ms
done
}
2 changes: 1 addition & 1 deletion test/sharness/t0030-mount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi
# start iptb + wait for peering
NUM_NODES=5
test_expect_success 'init iptb' '
iptb init -n $NUM_NODES --bootstrap=none --port=0
iptb testbed create -type localipfs -count $NUM_NODES -init
'
startup_cluster $NUM_NODES

Expand Down
2 changes: 1 addition & 1 deletion test/sharness/t0031-mount-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_init_ipfs
# start iptb + wait for peering
NUM_NODES=3
test_expect_success 'init iptb' '
iptb init -n $NUM_NODES -f --bootstrap=none --port=0 &&
iptb testbed create -type localipfs -count $NUM_NODES -force -init &&
startup_cluster $NUM_NODES
'

Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0041-ping.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ test_init_ipfs

# start iptb + wait for peering
test_expect_success 'init iptb' '
iptb init -n 2 --bootstrap=none --port=0
iptb testbed create -type localipfs -count 2 -init
'

startup_cluster 2

test_expect_success 'peer ids' '
PEERID_0=$(iptb get id 0) &&
PEERID_1=$(iptb get id 1)
PEERID_0=$(iptb attr get 0 id) &&
PEERID_1=$(iptb attr get 1 id)
'

test_expect_success "test ping other" '
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0101-iptb-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test_description="Test ipfs repo operations"
num_nodes=4

test_expect_success "set up an iptb cluster" '
iptb init -n $num_nodes -p 0 -f --bootstrap=none
iptb testbed create -type localipfs -count $num_nodes -force -init
'

startup_cluster $num_nodes
Expand All @@ -26,12 +26,12 @@ test_expect_success "publish that object as an ipns entry" '
'

test_expect_success "add an entry on another node pointing to that one" '
NODE1_ID=$(iptb get id 1) &&
NODE1_ID=$(iptb attr get 1 id) &&
ipfsi 2 name publish /ipns/$NODE1_ID
'

test_expect_success "cat that entry on a third node" '
NODE2_ID=$(iptb get id 2) &&
NODE2_ID=$(iptb attr get 2 id) &&
ipfsi 3 cat /ipns/$NODE2_ID > output
'

Expand Down
18 changes: 9 additions & 9 deletions test/sharness/t0121-bootstrap-iptb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ test_expect_success "disable mdns" '
test_launch_ipfs_daemon

test_expect_success "setup iptb nodes" '
iptb init -n 5 -f --bootstrap=none --port=0
iptb testbed create -type localipfs -count 5 -force -init
'

test_expect_success "start up iptb nodes" '
iptb start
iptb start -wait
'

test_expect_success "check peers works" '
Expand All @@ -38,11 +38,11 @@ betterwait() {
}

test_expect_success "bring down iptb nodes" '
PID0=$(cat "$IPTB_ROOT/0/daemon.pid") &&
PID1=$(cat "$IPTB_ROOT/1/daemon.pid") &&
PID2=$(cat "$IPTB_ROOT/2/daemon.pid") &&
PID3=$(cat "$IPTB_ROOT/3/daemon.pid") &&
PID4=$(cat "$IPTB_ROOT/4/daemon.pid") &&
PID0=$(cat "$IPTB_ROOT/benches/default/0/daemon.pid") &&
PID1=$(cat "$IPTB_ROOT/benches/default/1/daemon.pid") &&
PID2=$(cat "$IPTB_ROOT/benches/default/2/daemon.pid") &&
PID3=$(cat "$IPTB_ROOT/benches/default/3/daemon.pid") &&
PID4=$(cat "$IPTB_ROOT/benches/default/4/daemon.pid") &&
iptb stop && # TODO: add --wait flag to iptb stop
betterwait $PID0
betterwait $PID1
Expand All @@ -53,7 +53,7 @@ test_expect_success "bring down iptb nodes" '

test_expect_success "reset iptb nodes" '
# the api doesnt seem to get cleaned up in sharness tests for some reason
iptb init -n 5 -f --bootstrap=none --port=0
iptb testbed create -type localipfs -count 5 -force -init
'

test_expect_success "set bootstrap addrs" '
Expand All @@ -67,7 +67,7 @@ test_expect_success "set bootstrap addrs" '
'

test_expect_success "start up iptb nodes" '
iptb start --wait
iptb start -wait
'

test_expect_success "check peers works" '
Expand Down
2 changes: 1 addition & 1 deletion test/sharness/t0125-twonode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ run_advanced_test() {
}

test_expect_success "set up tcp testbed" '
iptb init -n 2 -p 0 -f --bootstrap=none
iptb testbed create -type localipfs -count 2 -force -init
'

# Enable quic but don't use it yet.
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0130-multinode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ run_advanced_test() {

test_expect_success "shut down nodes" '
iptb stop && iptb_wait_stop ||
test_fsh tail -n +1 .iptb/*/daemon.std*
test_fsh tail -n +1 .iptb/benches/default/*/daemon.std*
'
}

test_expect_success "set up /tcp testbed" '
iptb init -n 5 -p 0 -f --bootstrap=none
iptb testbed create -type localipfs -count 5 -force -init
'

# test multiplex muxer
Expand All @@ -97,7 +97,7 @@ unset LIBP2P_MUX_PREFS
run_advanced_test

test_expect_success "set up /ws testbed" '
iptb init -n 5 -ws -p 0 -f --bootstrap=none
iptb testbed create -type localipfs -count 5 -attr listentype,ws -force -init
'

# test multiplex muxer
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0131-multinode-client-routing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ run_single_file_test() {
NNODES=10

test_expect_success "set up testbed" '
iptb init -n $NNODES -p 0 -f --bootstrap=none
iptb testbed create -type localipfs -count $NNODES -force -init
'

test_expect_success "start up nodes" '
iptb start [0-7] &&
iptb start [8-9] --args="--routing=dhtclient"
iptb start -wait [0-7] &&
iptb start -wait [8-9] -- --routing=dhtclient
'

test_expect_success "connect up nodes" '
Expand Down
10 changes: 5 additions & 5 deletions test/sharness/t0140-swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,28 +98,28 @@ 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
iptb testbed create -type localipfs -count 2 -force -init
'

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 disconnect "/ipfs/$(iptb attr get 1 id)" &&
[ $(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 connect "/ipfs/$(iptb attr get 1 id)" &&
[ $(ipfsi 0 swarm peers | wc -l) -eq 1 ]
'

test_expect_success "/p2p addresses work" '
[ $(ipfsi 0 swarm peers | wc -l) -eq 1 ] &&
ipfsi 0 swarm disconnect "/p2p/$(iptb get id 1)" &&
ipfsi 0 swarm disconnect "/p2p/$(iptb attr get 1 id)" &&
[ $(ipfsi 0 swarm peers | wc -l) -eq 0 ] &&
ipfsi 0 swarm connect "/p2p/$(iptb get id 1)" &&
ipfsi 0 swarm connect "/p2p/$(iptb attr get 1 id)" &&
[ $(ipfsi 0 swarm peers | wc -l) -eq 1 ]
'

Expand Down
10 changes: 5 additions & 5 deletions test/sharness/t0170-dht.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ test_dht() {

test_expect_success 'init iptb' '
rm -rf .iptb/ &&
iptb init -n $NUM_NODES --bootstrap=none --port=0
iptb testbed create -type localipfs -count $NUM_NODES -init
'

startup_cluster $NUM_NODES "$@"
startup_cluster $NUM_NODES $@

test_expect_success 'peer ids' '
PEERID_0=$(iptb get id 0) &&
PEERID_2=$(iptb get id 2)
PEERID_0=$(iptb attr get 0 id) &&
PEERID_2=$(iptb attr get 2 id)
'

# ipfs dht findpeer <peerID>
Expand Down Expand Up @@ -70,7 +70,7 @@ test_dht() {
# ipfs dht findprovs <key>
test_expect_success 'findprovs' '
ipfsi 4 dht findprovs $HASH > provs &&
iptb get id 3 > expected &&
iptb attr get 3 id > expected &&
test_cmp provs expected
'

Expand Down
12 changes: 6 additions & 6 deletions test/sharness/t0175-reprovider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ NUM_NODES=6

init_strategy() {
test_expect_success 'init iptb' '
iptb init -f -n $NUM_NODES --bootstrap=none --port=0
iptb testbed create -type localipfs -force -count $NUM_NODES -init
'

test_expect_success 'peer ids' '
PEERID_0=$(iptb get id 0) &&
PEERID_1=$(iptb get id 1)
PEERID_0=$(iptb attr get 0 id) &&
PEERID_1=$(iptb attr get 1 id)
'

test_expect_success 'use pinning startegy for reprovider' '
Expand Down Expand Up @@ -123,12 +123,12 @@ test_expect_success 'stop peer 1' '

# Test reprovider working with ticking disabled
test_expect_success 'init iptb' '
iptb init -f -n $NUM_NODES --bootstrap=none --port=0
iptb testbed create -type localipfs -force -count $NUM_NODES -init
'

test_expect_success 'peer ids' '
PEERID_0=$(iptb get id 0) &&
PEERID_1=$(iptb get id 1)
PEERID_0=$(iptb attr get 0 id) &&
PEERID_1=$(iptb attr get 1 id)
'

test_expect_success 'Disable reprovider ticking' '
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0180-p2p.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test_description="Test experimental p2p commands"

# start iptb + wait for peering
test_expect_success 'init iptb' '
iptb init -n 3 --bootstrap=none --port=0
iptb testbed create -type localipfs --count 3 --init
'

test_expect_success 'generate test data' '
Expand All @@ -17,8 +17,8 @@ test_expect_success 'generate test data' '
startup_cluster 3

test_expect_success 'peer ids' '
PEERID_0=$(iptb get id 0) &&
PEERID_1=$(iptb get id 1)
PEERID_0=$(iptb attr get 0 id) &&
PEERID_1=$(iptb attr get 1 id)
'
check_test_ports() {
test_expect_success "test ports are closed" '
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0180-pubsub-gossipsub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test_description="Test pubsub with gossipsub"
# start iptb + wait for peering
NUM_NODES=5
test_expect_success 'init iptb' '
iptb init -n $NUM_NODES --bootstrap=none --port=0
iptb testbed create -type localipfs -count $NUM_NODES -init
'

test_expect_success "enable gossipsub" '
Expand All @@ -20,8 +20,8 @@ test_expect_success "enable gossipsub" '
startup_cluster $NUM_NODES --enable-pubsub-experiment

test_expect_success 'peer ids' '
PEERID_0=$(iptb get id 0) &&
PEERID_2=$(iptb get id 2)
PEERID_0=$(iptb attr get 0 id) &&
PEERID_2=$(iptb attr get 2 id)
'

test_expect_success 'pubsub' '
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0180-pubsub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ test_description="Test dht command"
# start iptb + wait for peering
NUM_NODES=5
test_expect_success 'init iptb' '
iptb init -n $NUM_NODES --bootstrap=none --port=0
iptb testbed create -type localipfs -count $NUM_NODES -init
'

startup_cluster $NUM_NODES --enable-pubsub-experiment

test_expect_success 'peer ids' '
PEERID_0=$(iptb get id 0) &&
PEERID_2=$(iptb get id 2)
PEERID_0=$(iptb attr get 0 id) &&
PEERID_2=$(iptb attr get 2 id)
'

# ipfs pubsub sub
Expand Down
Loading

1 comment on commit 498dbee

@GitCop
Copy link

@GitCop GitCop commented on 498dbee Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

Please sign in to comment.