Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
5fbf0d35
Commit
5fbf0d35
authored
Nov 15, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(sharness): fix dht tests
parent
32e891b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
25 deletions
+19
-25
test/sharness/t0170-dht.sh
test/sharness/t0170-dht.sh
+19
-25
No files found.
test/sharness/t0170-dht.sh
View file @
5fbf0d35
...
...
@@ -4,9 +4,6 @@ test_description="Test dht command"
.
lib/test-lib.sh
TEST_DHT_VALUE
=
"foobar"
TEST_DHT_PATH
=
"/pk/QmbWTwYGcmdyK9CYfNBcfs9nhZs17a6FQ4Y8oea278xx41"
test_dht
()
{
NUM_NODES
=
5
...
...
@@ -29,38 +26,35 @@ test_dht() {
test_cmp actual expected
'
# ipfs dht put <key> <value>
test_expect_failure
'put with good keys (#3124)'
'
ipfsi 0 dht put "$TEST_DHT_PATH" "$TEST_DHT_VALUE" | sort >putted &&
[ -s putted ] ||
test_fsh cat putted
'
test_expect_failure
'put round trips (#3124)'
'
echo -n "$TEST_DHT_VALUE" >expected &&
ipfsi 0 dht get "$TEST_DHT_PATH" >actual &&
test_cmp actual expected
'
# ipfs dht get <key>
test_expect_success
'get with good keys'
'
test_expect_success
'get with good keys
works
'
'
HASH="$(echo "hello world" | ipfsi 2 add -q)" &&
ipfsi 2 name publish "/ipfs/$HASH" &&
ipfsi 1 dht get "/ipns/$PEERID_2" | grep -aq "/ipfs/$HASH"
ipfsi 1 dht get "/ipns/$PEERID_2" >get_result
'
test_expect_success
'get with good keys contains the right value'
'
cat get_result | grep -aq "/ipfs/$HASH"
'
test_expect_success
'put round trips (#3124)'
'
ipfsi 0 dht put "/ipns/$PEERID_2" get_result | sort >putted &&
[ -s putted ] ||
test_fsh cat putted
'
test_expect_success
'put with bad keys fails (issue #5113)'
'
ipfsi 0 dht put "foo"
"
bar
"
>putted
ipfsi 0 dht put "/pk/foo"
"
bar
"
>>putted
ipfsi 0 dht put "/ipns/foo"
"
bar
"
>>putted
ipfsi 0 dht put "foo"
<<<
bar >putted
ipfsi 0 dht put "/pk/foo"
<<<
bar >>putted
ipfsi 0 dht put "/ipns/foo"
<<<
bar >>putted
[ ! -s putted ] ||
test_fsh cat putted
'
test_expect_success
'put with bad keys returns error (issue #4611)'
'
test_must_fail ipfsi 0 dht put "foo"
"
bar
"
&&
test_must_fail ipfsi 0 dht put "/pk/foo"
"
bar
"
&&
test_must_fail ipfsi 0 dht put "/ipns/foo"
"
bar
"
test_must_fail ipfsi 0 dht put "foo"
<<<
bar &&
test_must_fail ipfsi 0 dht put "/pk/foo"
<<<
bar &&
test_must_fail ipfsi 0 dht put "/ipns/foo"
<<<
bar
'
test_expect_success
'get with bad keys (issue #4611)'
'
...
...
@@ -101,7 +95,7 @@ test_dht() {
test_expect_success
"dht commands fail when offline"
'
test_must_fail ipfsi 0 dht findprovs "$HASH" 2>err_findprovs &&
test_must_fail ipfsi 0 dht findpeer "$HASH" 2>err_findpeer &&
test_must_fail ipfsi 0 dht put "
$TEST_DHT_PATH" "$TEST_DHT_VALUE
" 2>err_put &&
test_must_fail ipfsi 0 dht put "
/ipns/$PEERID_2" "get_result
" 2>err_put &&
test_should_contain "this command must be run in online mode" err_findprovs &&
test_should_contain "this command must be run in online mode" err_findpeer &&
test_should_contain "this command must be run in online mode" err_put
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment