Skip to content

Commit 92df0d6

Browse files
committed
reprovider: Fix sharness tests
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
1 parent c5c99c7 commit 92df0d6

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

exchange/reprovide/reprovide_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ func TestReprovide(t *testing.T) {
3333
bstore.Put(blk)
3434

3535
keyProvider := NewBlockstoreProvider(bstore)
36-
reprov := NewReprovider(clA, keyProvider)
37-
err := reprov.Reprovide(ctx)
36+
reprov := NewReprovider(ctx, clA, keyProvider)
37+
err := reprov.Reprovide()
3838
if err != nil {
3939
t.Fatal(err)
4040
}

test/sharness/t0175-reprovider.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test_description="Test reprovider"
55
. lib/test-lib.sh
66

77
init_strategy() {
8-
NUM_NODES=2
8+
NUM_NODES=6
99
test_expect_success 'init iptb' '
1010
iptb init -f -n $NUM_NODES --bootstrap=none --port=0
1111
'
@@ -19,30 +19,26 @@ init_strategy() {
1919
ipfsi 0 config Reprovider.Strategy '$1'
2020
'
2121

22-
test_expect_success 'start peers' '
23-
iptb start 0 &&
24-
iptb start 1 &&
25-
iptb connect 0 1
26-
'
22+
startup_cluster 6 --debug
2723
}
2824

2925
findprovs_empty() {
30-
test_expect_success 'findprovs succeeds' '
26+
test_expect_success 'findprovs '$1' succeeds' '
3127
ipfsi 1 dht findprovs -n 1 '$1' > findprovsOut
3228
'
3329

34-
test_expect_success "findprovs output is empty" '
30+
test_expect_success "findprovs $1 output is empty" '
3531
test_must_be_empty findprovsOut
3632
'
3733
}
3834

3935
findprovs_expect() {
40-
test_expect_success 'findprovs succeeds' '
36+
test_expect_success 'findprovs '$1' succeeds' '
4137
ipfsi 1 dht findprovs -n 1 '$1' > findprovsOut &&
4238
echo '$2' > expected
4339
'
4440

45-
test_expect_success "findprovs output looks good" '
41+
test_expect_success "findprovs $1 output looks good" '
4642
test_cmp findprovsOut expected
4743
'
4844
}
@@ -102,13 +98,15 @@ init_strategy 'roots'
10298

10399
test_expect_success 'prepare test files' '
104100
echo foo > f1 &&
105-
echo bar > f2
101+
echo bar > f2 &&
102+
echo baz > f3
106103
'
107104

108105
test_expect_success 'add test objects' '
109106
HASH_FOO=$(ipfsi 0 add -q --local --pin=false f1) &&
110107
HASH_BAR=$(ipfsi 0 add -q --local --pin=false f2) &&
111-
HASH_BAR_DIR=$(ipfsi 0 add -q --local -w f2)
108+
HASH_BAZ=$(ipfsi 0 add -q --local f3) &&
109+
HASH_BAR_DIR=$(ipfsi 0 add -q --local -w f2 | tail -1)
112110
'
113111

114112
findprovs_empty '$HASH_FOO'
@@ -119,6 +117,7 @@ reprovide
119117

120118
findprovs_empty '$HASH_FOO'
121119
findprovs_empty '$HASH_BAR'
120+
findprovs_expect '$HASH_BAZ' '$PEERID_0'
122121
findprovs_expect '$HASH_BAR_DIR' '$PEERID_0'
123122

124123
test_expect_success 'stop peer 1' '

0 commit comments

Comments
 (0)