mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
Update IPTB test - WIP
Related to #5521 License: MIT Signed-off-by: Travis Person <travis@protocol.ai>
This commit is contained in:
parent
1c463819ec
commit
569eeb8f82
@ -47,9 +47,9 @@
|
||||
"version": "0.1.4"
|
||||
},
|
||||
{
|
||||
"hash": "QmV1DPm5F46LvQMxCVPhu35zHgZEeMvyVtpxjb5TwfGiua",
|
||||
"hash": "QmU5w6sBozzDcfHXuKn1ZZAYuBw1rE57YYRVxgUcCjEX8C",
|
||||
"name": "iptb",
|
||||
"version": "1.3.19"
|
||||
"version": "2.0.0"
|
||||
},
|
||||
{
|
||||
"hash": "QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8",
|
||||
|
||||
@ -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
|
||||
@ -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)):
|
||||
|
||||
@ -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() {
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
'
|
||||
|
||||
|
||||
@ -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" '
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
'
|
||||
|
||||
|
||||
@ -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" '
|
||||
@ -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
|
||||
@ -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" '
|
||||
@ -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" '
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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" '
|
||||
|
||||
@ -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 ]
|
||||
'
|
||||
|
||||
|
||||
@ -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>
|
||||
@ -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
|
||||
'
|
||||
|
||||
|
||||
@ -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' '
|
||||
@ -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' '
|
||||
|
||||
@ -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' '
|
||||
@ -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" '
|
||||
|
||||
@ -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" '
|
||||
@ -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' '
|
||||
|
||||
@ -7,13 +7,13 @@ 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
|
||||
'
|
||||
|
||||
run_pubsub_tests() {
|
||||
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
|
||||
|
||||
@ -34,15 +34,15 @@ pnet_key > "${IPFS_PATH}/swarm.key"
|
||||
LIBP2P_FORCE_PNET=1 test_launch_ipfs_daemon
|
||||
|
||||
test_expect_success "set up iptb testbed" '
|
||||
iptb init -n 5 -p 0 -f --bootstrap=none &&
|
||||
iptb for-each ipfs config --json Addresses.Swarm '"'"'["/ip4/127.0.0.1/tcp/0"]'"'"'
|
||||
iptb testbed create -type localipfs -count 5 -force -init &&
|
||||
iptb run -- ipfs config --json Addresses.Swarm '"'"'["/ip4/127.0.0.1/tcp/0"]'"'"'
|
||||
'
|
||||
|
||||
set_key() {
|
||||
node="$1"
|
||||
keyfile="$2"
|
||||
|
||||
cp "$keyfile" "${IPTB_ROOT}/${node}/swarm.key"
|
||||
cp "$keyfile" "${IPTB_ROOT}/testbeds/default/${node}/swarm.key"
|
||||
}
|
||||
|
||||
pnet_key > key1
|
||||
@ -57,7 +57,7 @@ set_key 4 key2
|
||||
unset LIBP2P_FORCE_PNET
|
||||
|
||||
test_expect_success "start nodes" '
|
||||
iptb start [0-4]
|
||||
iptb start -wait [0-4]
|
||||
'
|
||||
|
||||
test_expect_success "try connecting node in public network with priv networks" '
|
||||
|
||||
@ -7,12 +7,12 @@ test_description="Test circuit relay"
|
||||
# start iptb + wait for peering
|
||||
NUM_NODES=3
|
||||
test_expect_success 'init iptb' '
|
||||
iptb init -n $NUM_NODES --bootstrap=none --port=0
|
||||
iptb testbed create -type localipfs -count $NUM_NODES -init
|
||||
'
|
||||
|
||||
# Network toplogy: A <-> Relay <-> B
|
||||
test_expect_success 'start up nodes for configuration' '
|
||||
iptb start --args --routing=none
|
||||
iptb start -wait -- --routing=none
|
||||
'
|
||||
|
||||
test_expect_success 'configure EnableRelayHop in relay node' '
|
||||
@ -22,7 +22,7 @@ test_expect_success 'configure EnableRelayHop in relay node' '
|
||||
test_expect_success 'restart nodes' '
|
||||
iptb stop &&
|
||||
iptb_wait_stop &&
|
||||
iptb start --args --routing=none
|
||||
iptb start -wait -- --routing=none
|
||||
'
|
||||
|
||||
test_expect_success 'connect A <-> Relay' '
|
||||
@ -38,9 +38,9 @@ test_expect_success 'wait until relay is ready to do work' '
|
||||
'
|
||||
|
||||
test_expect_success 'peer ids' '
|
||||
PEERID_0=$(iptb get id 0) &&
|
||||
PEERID_1=$(iptb get id 1) &&
|
||||
PEERID_2=$(iptb get id 2)
|
||||
PEERID_0=$(iptb attr get 0 id) &&
|
||||
PEERID_1=$(iptb attr get 1 id) &&
|
||||
PEERID_2=$(iptb attr get 2 id)
|
||||
'
|
||||
|
||||
test_expect_success 'connect A <-Relay-> B' '
|
||||
|
||||
@ -7,13 +7,13 @@ test_description="Test IPNS pubsub"
|
||||
# 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-namesys-pubsub
|
||||
|
||||
test_expect_success 'peer ids' '
|
||||
PEERID_0=$(iptb get id 0)
|
||||
PEERID_0=$(iptb attr get 0 id)
|
||||
'
|
||||
|
||||
test_expect_success 'check namesys pubsub state' '
|
||||
|
||||
@ -8,7 +8,7 @@ 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
|
||||
'
|
||||
|
||||
test_expect_success "enable QUIC experiment" '
|
||||
@ -26,8 +26,8 @@ test_expect_success "add QUIC swarm addresses" '
|
||||
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" '
|
||||
|
||||
@ -15,7 +15,7 @@ setup_iptb() {
|
||||
bound=$(expr "$num_nodes" - 1)
|
||||
|
||||
test_expect_success "iptb init" '
|
||||
iptb init -n $num_nodes --bootstrap none --port 0
|
||||
iptb testbed create -type localipfs -count $num_nodes -init
|
||||
'
|
||||
|
||||
for i in $(test_seq 0 "$bound")
|
||||
@ -31,7 +31,7 @@ setup_iptb() {
|
||||
|
||||
teardown_iptb() {
|
||||
test_expect_success "shut down nodes" '
|
||||
iptb kill
|
||||
iptb stop
|
||||
'
|
||||
}
|
||||
|
||||
|
||||
@ -95,30 +95,31 @@ test_expect_success "check that we can access the file when converted to CIDv1"
|
||||
#
|
||||
|
||||
test_expect_success "set up iptb testbed" '
|
||||
iptb init -n 2 -p 0 -f --bootstrap=none
|
||||
iptb testbed create -type localipfs -count 2 -init
|
||||
'
|
||||
|
||||
test_expect_success "start nodes" '
|
||||
iptb start &&
|
||||
iptb start -wait &&
|
||||
iptb connect 0 1
|
||||
'
|
||||
|
||||
test_expect_success "add afile using CIDv0 to node 0" '
|
||||
iptb run 0 ipfs add -q --cid-version=0 afile
|
||||
iptb run 0 -- ipfs add -q --cid-version=0 afile
|
||||
'
|
||||
|
||||
test_expect_success "get afile using CIDv1 via node 1" '
|
||||
iptb run 1 ipfs --timeout=2s cat $AHASHv1 > thefile &&
|
||||
iptb run -raw 1 -- ipfs --timeout=2s cat $AHASHv1 > thefile &&
|
||||
test_cmp afile thefile
|
||||
'
|
||||
|
||||
test_expect_success "add bfile using CIDv1 to node 0" '
|
||||
BHASHv1=$(iptb run 0 ipfs add -q --cid-version=1 --raw-leaves=false bfile)
|
||||
BHASHv1=$(iptb run -raw 0 -- ipfs add -q --cid-version=1 --raw-leaves=false bfile)
|
||||
'
|
||||
|
||||
test_expect_success "get bfile using CIDv0 via node 1" '
|
||||
BHASHv0=$(cid-fmt -v 0 %s $BHASHv1)
|
||||
iptb run 1 ipfs --timeout=2s cat $BHASHv0 > thefile &&
|
||||
echo $BHASHv1 &&
|
||||
iptb run -raw 1 -- ipfs --timeout=2s cat $BHASHv0 > thefile &&
|
||||
test_cmp bfile thefile
|
||||
'
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user