Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update IPTB test #5636

Merged
merged 5 commits into from
Nov 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"version": "0.1.4"
},
{
"hash": "QmV1DPm5F46LvQMxCVPhu35zHgZEeMvyVtpxjb5TwfGiua",
"hash": "QmckeQ2zrYLAXoSHYTGn5BDdb22BqbUoHEHm8KZ9YWRxd1",
"name": "iptb",
"version": "1.3.19"
"version": "2.0.0"
},
{
"hash": "QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8",
Expand Down Expand Up @@ -586,6 +586,12 @@
"hash": "QmY4dowpPFCBsbaoaJc9mNWso64eDJsm32LJznwPNaAiJG",
"name": "go-libp2p-pubsub",
"version": "0.11.3"
},
{
"author": "travisperson",
"hash": "QmX51YXMSkZWJ6fQFP8ieQvwTbmLFK1YbGHqeJwgLvjkZU",
"name": "iptb-plugins",
"version": "1.0.0"
}
],
"gxVersion": "0.10.0",
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,6 +14,10 @@ $(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
Expand All @@ -22,7 +26,7 @@ $(d)/json-to-junit: test/dependencies/json-to-junit
$(go-build)
TGTS_$(d) += $(d)/json-to-junit

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

$(TGTS_GX_$(d)):
Expand Down
34 changes: 34 additions & 0 deletions test/dependencies/iptb/iptb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import (
"fmt"
"os"

cli "gx/ipfs/QmckeQ2zrYLAXoSHYTGn5BDdb22BqbUoHEHm8KZ9YWRxd1/iptb/cli"
testbed "gx/ipfs/QmckeQ2zrYLAXoSHYTGn5BDdb22BqbUoHEHm8KZ9YWRxd1/iptb/testbed"

plugin "gx/ipfs/QmX51YXMSkZWJ6fQFP8ieQvwTbmLFK1YbGHqeJwgLvjkZU/iptb-plugins/local"
)

func init() {
_, err := testbed.RegisterPlugin(testbed.IptbPlugin{
From: "<builtin>",
NewNode: plugin.NewNode,
GetAttrList: plugin.GetAttrList,
GetAttrDesc: plugin.GetAttrDesc,
PluginName: plugin.PluginName,
BuiltIn: true,
}, false)

if err != nil {
panic(err)
}
}

func main() {
cli := cli.NewCli()
if err := cli.Run(os.Args); err != nil {
fmt.Fprintf(cli.ErrWriter, "%s\n", err)
os.Exit(1)
}
}
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 @@ -10,14 +10,14 @@ BAD_PEER="QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJx"

# 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
Loading