mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 12:57:44 +08:00
test: use car fixtures in sharness t0123
This commit is contained in:
parent
a57ca965c1
commit
7f3c0baa5d
@ -7,22 +7,15 @@ test_description="Test HTTP Gateway DAG-JSON (application/vnd.ipld.dag-json) and
|
||||
test_init_ipfs
|
||||
test_launch_ipfs_daemon_without_network
|
||||
|
||||
# Import test case
|
||||
# See the static fixtures in ./t0123-gateway-json-cbor/
|
||||
test_expect_success "Add the test directory" '
|
||||
mkdir -p rootDir/ipfs &&
|
||||
mkdir -p rootDir/ipns &&
|
||||
mkdir -p rootDir/api &&
|
||||
mkdir -p rootDir/ą/ę &&
|
||||
echo "{ \"test\": \"i am a plain json file\" }" > rootDir/ą/ę/t.json &&
|
||||
echo "I am a txt file on path with utf8" > rootDir/ą/ę/file-źł.txt &&
|
||||
echo "I am a txt file in confusing /api dir" > rootDir/api/file.txt &&
|
||||
echo "I am a txt file in confusing /ipfs dir" > rootDir/ipfs/file.txt &&
|
||||
echo "I am a txt file in confusing /ipns dir" > rootDir/ipns/file.txt &&
|
||||
DIR_CID=$(ipfs add -Qr --cid-version 1 rootDir) &&
|
||||
FILE_JSON_CID=$(ipfs files stat --enc=json /ipfs/$DIR_CID/ą/ę/t.json | jq -r .Hash) &&
|
||||
FILE_CID=$(ipfs files stat --enc=json /ipfs/$DIR_CID/ą/ę/file-źł.txt | jq -r .Hash) &&
|
||||
FILE_SIZE=$(ipfs files stat --enc=json /ipfs/$DIR_CID/ą/ę/file-źł.txt | jq -r .Size)
|
||||
echo "$FILE_CID / $FILE_SIZE"
|
||||
ipfs dag import ../t0123-gateway-json-cbor/fixtures.car
|
||||
'
|
||||
DIR_CID=bafybeiafyvqlazbbbtjnn6how5d6h6l6rxbqc4qgpbmteaiskjrffmyy4a # ./rootDir
|
||||
FILE_JSON_CID=bafkreibrppizs3g7axs2jdlnjua6vgpmltv7k72l7v7sa6mmht6mne3qqe # ./rootDir/ą/ę/t.json
|
||||
FILE_CID=bafkreialihlqnf5uwo4byh4n3cmwlntwqzxxs2fg5vanqdi3d7tb2l5xkm # ./rootDir/ą/ę/file-źł.txt
|
||||
FILE_SIZE=34
|
||||
|
||||
## Quick regression check for JSON stored on UnixFS:
|
||||
## it has nothing to do with DAG-JSON and JSON codecs,
|
||||
|
||||
43
test/sharness/t0123-gateway-json-cbor/README.md
Normal file
43
test/sharness/t0123-gateway-json-cbor/README.md
Normal file
@ -0,0 +1,43 @@
|
||||
# Dataset description/sources
|
||||
|
||||
- dag-cbor-traversal.car
|
||||
|
||||
- dag-json-traversal.car
|
||||
|
||||
- dag-pb.car
|
||||
|
||||
- dag-pb.json
|
||||
|
||||
- fixtures.car
|
||||
- raw CARv1
|
||||
|
||||
generated with:
|
||||
|
||||
```sh
|
||||
mkdir -p rootDir/ipfs &&
|
||||
mkdir -p rootDir/ipns &&
|
||||
mkdir -p rootDir/api &&
|
||||
mkdir -p rootDir/ą/ę &&
|
||||
echo "{ \"test\": \"i am a plain json file\" }" > rootDir/ą/ę/t.json &&
|
||||
echo "I am a txt file on path with utf8" > rootDir/ą/ę/file-źł.txt &&
|
||||
echo "I am a txt file in confusing /api dir" > rootDir/api/file.txt &&
|
||||
echo "I am a txt file in confusing /ipfs dir" > rootDir/ipfs/file.txt &&
|
||||
echo "I am a txt file in confusing /ipns dir" > rootDir/ipns/file.txt &&
|
||||
DIR_CID=$(ipfs add -Qr --cid-version 1 rootDir) &&
|
||||
FILE_JSON_CID=$(ipfs files stat --enc=json /ipfs/$DIR_CID/ą/ę/t.json | jq -r .Hash) &&
|
||||
FILE_CID=$(ipfs files stat --enc=json /ipfs/$DIR_CID/ą/ę/file-źł.txt | jq -r .Hash) &&
|
||||
FILE_SIZE=$(ipfs files stat --enc=json /ipfs/$DIR_CID/ą/ę/file-źł.txt | jq -r .Size)
|
||||
echo "$FILE_CID / $FILE_SIZE"
|
||||
|
||||
echo DIR_CID=${DIR_CID} # ./rootDir
|
||||
echo FILE_JSON_CID=${FILE_JSON_CID} # ./rootDir/ą/ę/t.json
|
||||
echo FILE_CID=${FILE_CID} # ./rootDir/ą/ę/file-źł.txt
|
||||
echo FILE_SIZE=${FILE_SIZE}
|
||||
|
||||
ipfs dag export ${DIR_CID} > fixtures.car
|
||||
|
||||
# DIR_CID=bafybeiafyvqlazbbbtjnn6how5d6h6l6rxbqc4qgpbmteaiskjrffmyy4a # ./rootDir
|
||||
# FILE_JSON_CID=bafkreibrppizs3g7axs2jdlnjua6vgpmltv7k72l7v7sa6mmht6mne3qqe # ./rootDir/ą/ę/t.json
|
||||
# FILE_CID=bafkreialihlqnf5uwo4byh4n3cmwlntwqzxxs2fg5vanqdi3d7tb2l5xkm # ./rootDir/ą/ę/file-źł.txt
|
||||
# FILE_SIZE=34
|
||||
```
|
||||
BIN
test/sharness/t0123-gateway-json-cbor/fixtures.car
Normal file
BIN
test/sharness/t0123-gateway-json-cbor/fixtures.car
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user