mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-22 04:09:04 +08:00
add new test to show problem
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
@ -22,9 +22,16 @@ check_file_fetch() {
|
|||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
run_basic_test() {
|
check_dir_fetch() {
|
||||||
startup_cluster 5
|
node=$1
|
||||||
|
ref=$2
|
||||||
|
|
||||||
|
test_expect_success "node can fetch all refs for dir" '
|
||||||
|
ipfsi $node refs -r $ref > /dev/null
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
run_single_file_test() {
|
||||||
test_expect_success "add a file on node1" '
|
test_expect_success "add a file on node1" '
|
||||||
random 1000000 > filea &&
|
random 1000000 > filea &&
|
||||||
FILEA_HASH=$(ipfsi 1 add -q filea)
|
FILEA_HASH=$(ipfsi 1 add -q filea)
|
||||||
@ -35,6 +42,41 @@ run_basic_test() {
|
|||||||
check_file_fetch 2 $FILEA_HASH filea
|
check_file_fetch 2 $FILEA_HASH filea
|
||||||
check_file_fetch 1 $FILEA_HASH filea
|
check_file_fetch 1 $FILEA_HASH filea
|
||||||
check_file_fetch 0 $FILEA_HASH filea
|
check_file_fetch 0 $FILEA_HASH filea
|
||||||
|
}
|
||||||
|
|
||||||
|
run_random_dir_test() {
|
||||||
|
test_expect_success "create a bunch of random files" '
|
||||||
|
random-files -depth=4 -dirs=5 -files=8 foobar > /dev/null
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success "add those on node 2" '
|
||||||
|
DIR_HASH=$(ipfsi 2 add -r -q foobar | tail -n1)
|
||||||
|
'
|
||||||
|
|
||||||
|
check_dir_fetch 0 $DIR_HASH
|
||||||
|
check_dir_fetch 1 $DIR_HASH
|
||||||
|
check_dir_fetch 2 $DIR_HASH
|
||||||
|
check_dir_fetch 3 $DIR_HASH
|
||||||
|
check_dir_fetch 4 $DIR_HASH
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
run_basic_test() {
|
||||||
|
startup_cluster 5
|
||||||
|
|
||||||
|
run_single_file_test
|
||||||
|
|
||||||
|
test_expect_success "shut down nodes" '
|
||||||
|
iptb stop
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
run_advanced_test() {
|
||||||
|
startup_cluster 5
|
||||||
|
|
||||||
|
run_single_file_test
|
||||||
|
|
||||||
|
run_random_dir_test
|
||||||
|
|
||||||
test_expect_success "shut down nodes" '
|
test_expect_success "shut down nodes" '
|
||||||
iptb stop
|
iptb stop
|
||||||
@ -45,12 +87,13 @@ test_expect_success "set up tcp testbed" '
|
|||||||
iptb init -n 5 -p 0 -f --bootstrap=none
|
iptb init -n 5 -p 0 -f --bootstrap=none
|
||||||
'
|
'
|
||||||
|
|
||||||
run_basic_test
|
run_advanced_test
|
||||||
|
|
||||||
test_expect_success "set up utp testbed" '
|
test_expect_success "set up utp testbed" '
|
||||||
iptb init -n 5 -p 0 -f --bootstrap=none --utp
|
iptb init -n 5 -p 0 -f --bootstrap=none --utp
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# currently have issues with utp running the advanced tests
|
||||||
run_basic_test
|
run_basic_test
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user