Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(car): export/import of (dag-)cbor/json codecs #9348

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions test/sharness/t0054-dag-car-import-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,32 @@ test_expect_success "version 2 import output as expected" '
test_cmp_sorted version_2_import_expected version_2_import_actual
'

test_expect_success "'ipfs dag import' decode IPLD dag-json works" '
HASH=$(echo "dag-json content" | ipfs add -Q) &&
# We dont pipe because that doesnt release the repo lock
ipfs dag get $HASH > dag-json.out &&
NEW_HASH=$(ipfs dag put --store-codec dag-json dag-json.out) &&
test_expect_success "'ipfs dag import' decode IPLD 'dag-json' codec works" '
NEW_HASH=$(echo "{ \"test\": \"dag-json\" }" | ipfs dag put --store-codec dag-json) &&
ipfs dag export $NEW_HASH > dag-json.car &&
ipfs dag import dag-json.car &&
rm dag-json.out dag-json.car
rm dag-json.car
'

test_expect_success "'ipfs dag import' decode IPLD 'dag-cbor' codec works" '
NEW_HASH=$(echo "{ \"test\": \"dag-cbor\" }" | ipfs dag put --store-codec dag-cbor) &&
ipfs dag export $NEW_HASH > dag-cbor.car &&
ipfs dag import dag-cbor.car &&
rm dag-cbor.car
'

test_expect_success "'ipfs dag import' decode IPLD 'json' codec works" '
NEW_HASH=$(echo "{ \"test\": \"json\" }" | ipfs dag put --store-codec json) &&
ipfs dag export $NEW_HASH > json.car &&
ipfs dag import json.car &&
rm json.car
'

test_expect_success "'ipfs dag import' decode IPLD 'cbor' codec works" '
NEW_HASH=$(echo "{ \"test\": \"cbor\" }" | ipfs dag put --store-codec cbor) &&
ipfs dag export $NEW_HASH > cbor.car &&
ipfs dag import cbor.car &&
rm cbor.car
'

test_done