Skip to content

Commit

Permalink
bring back t0090-get.sh test
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Mar 21, 2024
1 parent c552d08 commit 4d06f2c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/sharness/t0090-get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,30 @@ test_get_cmd() {
'
}

test_get_fail() {
test_expect_success "create an object that has unresolvable links" '
cat <<-\EOF >bad_object &&
{"Data":{"/":{"bytes":"CAE"}},"Links":[{"Hash":{"/":"Qmd4mG6pDFDmDTn6p3hX1srP8qTbkyXKj5yjpEsiHDX3u8"},"Name":"bar","Tsize":56},{"Hash":{"/":"QmUTjwRnG28dSrFFVTYgbr6LiDLsBmRr2SaUSTGheK2YqG"},"Name":"baz","Tsize":24266},{"Hash":{"/":"QmZzaC6ydNXiR65W8VjGA73ET9MZ6VFAqUT1ngYMXcpihn"},"Name":"foo","Tsize":1897}]}
EOF
cat bad_object | ipfs dag put --store-codec dag-pb > put_out
'

test_expect_success "output looks good" '
echo "bafybeifrjjol3gixedca6etdwccnvwfvhurc4wb3i5mnk2rvwvyfcgwxd4" > put_exp &&
test_cmp put_exp put_out
'

test_expect_success "ipfs get fails" '
test_expect_code 1 ipfs get QmaGidyrnX8FMbWJoxp8HVwZ1uRKwCyxBJzABnR1S2FVUr
'
}

# should work offline
test_get_cmd

# only really works offline, will try and search network when online
test_get_fail

# should work online
test_launch_ipfs_daemon
test_get_cmd
Expand Down

0 comments on commit 4d06f2c

Please sign in to comment.