-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9657 from laurentsenta/test/sharness-with-car-fix…
…tures test(gateway): use deterministic CAR fixtures
- Loading branch information
Showing
33 changed files
with
343 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Dataset description/sources | ||
|
||
- testfiles.car | ||
- raw CARv1 | ||
|
||
generated with: | ||
|
||
```sh | ||
# using ipfs version 0.18.1 | ||
mkdir testfiles && | ||
echo "content" > testfiles/foo && | ||
ln -s foo testfiles/bar && | ||
ROOT_DIR_CID=$(ipfs add -Qr testfiles) && | ||
ipfs dag export $ROOT_DIR_CID > testfiles.car | ||
|
||
# ROOT_DIR_CID=QmWvY6FaqFMS89YAQ9NAPjVP4WZKA1qbHbicc9HeSKQTgt | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Dataset description/sources | ||
|
||
- fixtures.car | ||
- raw CARv1 | ||
|
||
generated with: | ||
|
||
```sh | ||
# using ipfs version 0.18.1 | ||
|
||
# CIDv0to1 is necessary because raw-leaves are enabled by default during | ||
# "ipfs add" with CIDv1 and disabled with CIDv0 | ||
CID_VAL="hello" | ||
CIDv1=$(echo $CID_VAL | ipfs add --cid-version 1 -Q) | ||
CIDv0=$(echo $CID_VAL | ipfs add --cid-version 0 -Q) | ||
CIDv0to1=$(echo "$CIDv0" | ipfs cid base32) | ||
# sha512 will be over 63char limit, even when represented in Base36 | ||
CIDv1_TOO_LONG=$(echo $CID_VAL | ipfs add --cid-version 1 --hash sha2-512 -Q) | ||
|
||
echo CIDv1=${CIDv1} | ||
echo CIDv0=${CIDv0} | ||
echo CIDv0to1=${CIDv0to1} | ||
echo CIDv1_TOO_LONG=${CIDv1_TOO_LONG} | ||
|
||
# Directory tree crafted to test for edge cases like "/ipfs/ipfs/ipns/bar" | ||
mkdir -p testdirlisting/ipfs/ipns && | ||
echo "hello" > testdirlisting/hello && | ||
echo "text-file-content" > testdirlisting/ipfs/ipns/bar && | ||
mkdir -p testdirlisting/api && | ||
mkdir -p testdirlisting/ipfs && | ||
echo "I am a txt file" > testdirlisting/api/file.txt && | ||
echo "I am a txt file" > testdirlisting/ipfs/file.txt && | ||
DIR_CID=$(ipfs add -Qr --cid-version 1 testdirlisting) | ||
|
||
echo DIR_CID=${DIR_CID} | ||
|
||
ipfs files mkdir /t0114/ | ||
ipfs files cp /ipfs/${CIDv1} /t0114/ | ||
ipfs files cp /ipfs/${CIDv0} /t0114/ | ||
ipfs files cp /ipfs/${CIDv0to1} /t0114/ | ||
ipfs files cp /ipfs/${DIR_CID} /t0114/ | ||
ipfs files cp /ipfs/${CIDv1_TOO_LONG} /t0114/ | ||
|
||
ROOT=`ipfs files stat /t0114/ --hash` | ||
|
||
ipfs dag export ${ROOT} > ./fixtures.car | ||
|
||
# CID_VAL="hello" | ||
# CIDv1=bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am | ||
# CIDv0=QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN | ||
# CIDv0to1=bafybeiffndsajwhk3lwjewwdxqntmjm4b5wxaaanokonsggenkbw6slwk4 | ||
# CIDv1_TOO_LONG=bafkrgqhhyivzstcz3hhswshfjgy6ertgmnqeleynhwt4dlfsthi4hn7zgh4uvlsb5xncykzapi3ocd4lzogukir6ksdy6wzrnz6ohnv4aglcs | ||
# DIR_CID=bafybeiht6dtwk3les7vqm6ibpvz6qpohidvlshsfyr7l5mpysdw2vmbbhe # ./testdirlisting | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Dataset description/sources | ||
|
||
- fixtures.car | ||
- raw CARv1 | ||
|
||
generated with: | ||
|
||
```sh | ||
# using ipfs version 0.18.1 | ||
mkdir -p rootDir/ipfs && | ||
mkdir -p rootDir/ipns && | ||
mkdir -p rootDir/api && | ||
mkdir -p rootDir/ą/ę && | ||
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_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} | ||
echo FILE_CID=${FILE_CID} | ||
echo FILE_SIZE=${FILE_SIZE} | ||
|
||
ipfs dag export ${DIR_CID} > ./fixtures.car | ||
|
||
# DIR_CID=bafybeig6ka5mlwkl4subqhaiatalkcleo4jgnr3hqwvpmsqfca27cijp3i # ./rootDir/ | ||
# FILE_CID=bafkreialihlqnf5uwo4byh4n3cmwlntwqzxxs2fg5vanqdi3d7tb2l5xkm # ./rootDir/ą/ę/file-źł.txt | ||
# FILE_SIZE=34 | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Dataset description/sources | ||
|
||
- fixtures.car | ||
- raw CARv1 | ||
|
||
generated with: | ||
|
||
```sh | ||
# using ipfs version 0.18.1 | ||
mkdir -p root2/root3/root4 && | ||
echo "hello" > root2/root3/root4/index.html && | ||
ROOT1_CID=$(ipfs add -Qrw --cid-version 1 root2) | ||
ROOT2_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2 | cut -d "/" -f3) | ||
ROOT3_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3 | cut -d "/" -f3) | ||
ROOT4_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3/root4 | cut -d "/" -f3) | ||
FILE_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3/root4/index.html | cut -d "/" -f3) | ||
|
||
echo ROOT1_CID=${ROOT1_CID} | ||
echo ROOT2_CID=${ROOT2_CID} | ||
echo ROOT3_CID=${ROOT3_CID} | ||
echo ROOT4_CID=${ROOT4_CID} | ||
echo FILE_CID=${FILE_CID} | ||
|
||
ipfs dag export ${ROOT1_CID} > ./fixtures.car | ||
|
||
# ROOT1_CID=bafybeib3ffl2teiqdncv3mkz4r23b5ctrwkzrrhctdbne6iboayxuxk5ui # ./ | ||
# ROOT2_CID=bafybeih2w7hjocxjg6g2ku25hvmd53zj7og4txpby3vsusfefw5rrg5sii # ./root2 | ||
# ROOT3_CID=bafybeiawdvhmjcz65x5egzx4iukxc72hg4woks6v6fvgyupiyt3oczk5ja # ./root2/root3 | ||
# ROOT4_CID=bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q # ./root2/root3/root4 | ||
# FILE_CID=bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am # ./root2/root3/root4/index.html | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Dataset description/sources | ||
|
||
- fixtures.car | ||
- raw CARv1 | ||
|
||
generated with: | ||
|
||
```sh | ||
# using ipfs version 0.18.1 | ||
mkdir -p dir && | ||
echo "hello application/vnd.ipld.raw" > dir/ascii.txt && | ||
ROOT_DIR_CID=$(ipfs add -Qrw --cid-version 1 dir) && | ||
FILE_CID=$(ipfs resolve -r /ipfs/$ROOT_DIR_CID/dir/ascii.txt | cut -d "/" -f3) && | ||
ipfs dag export $ROOT_DIR_CID > fixtures.car | ||
|
||
echo ROOT_DIR_CID=${ROOT_DIR_CID} # ./ | ||
echo FILE_CID=${FILE_CID} # ./dir/ascii.txt | ||
|
||
# ROOT_DIR_CID=bafybeie72edlprgtlwwctzljf6gkn2wnlrddqjbkxo3jomh4n7omwblxly # ./ | ||
# FILE_CID=bafkreihhpc5y2pqvl5rbe5uuyhqjouybfs3rvlmisccgzue2kkt5zq6upq # ./dir/ascii.txt | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.