@cryptotaxi247 / kubo / commits / 0d7c892ce

test: use car fixtures in sharness t0117

Laurent Senta committed Feb 15, 2023 at 15:31 UTC 0d7c892cecd81eed22ce141608df698ba6902b78
3 files changed +26 -5
test/sharness/t0117-gateway-block.sh
+6 -5
@@ -7,12 +7,13 @@ test_description="Test HTTP Gateway Raw Block (application/vnd.ipld.raw) Support
7 test_init_ipfs
8 test_launch_ipfs_daemon_without_network
9
10 -test_expect_success "Create text fixtures" '
11 - mkdir -p dir &&
12 - echo "hello application/vnd.ipld.raw" > dir/ascii.txt &&
13 - ROOT_DIR_CID=$(ipfs add -Qrw --cid-version 1 dir) &&
14 - FILE_CID=$(ipfs resolve -r /ipfs/$ROOT_DIR_CID/dir/ascii.txt | cut -d "/" -f3)
10 +# Import test case
11 +# See the static fixtures in ./t0117-gateway-block/
12 +test_expect_success "Add the dir test directory" '
13 + ipfs dag import ../t0117-gateway-block/fixtures.car
14 '
15 +ROOT_DIR_CID=bafybeie72edlprgtlwwctzljf6gkn2wnlrddqjbkxo3jomh4n7omwblxly # ./
16 +FILE_CID=bafkreihhpc5y2pqvl5rbe5uuyhqjouybfs3rvlmisccgzue2kkt5zq6upq # ./dir/ascii.txt
17
18 # GET unixfs dir root block and compare it with `ipfs block get` output
19
test/sharness/t0117-gateway-block/README.md new
+20
@@ -0,0 +1,20 @@
1 +# Dataset description/sources
2 +
3 +- fixtures.car
4 + - raw CARv1
5 +
6 +generated with:
7 +
8 +```sh
9 +mkdir -p dir &&
10 +echo "hello application/vnd.ipld.raw" > dir/ascii.txt &&
11 +ROOT_DIR_CID=$(ipfs add -Qrw --cid-version 1 dir) &&
12 +FILE_CID=$(ipfs resolve -r /ipfs/$ROOT_DIR_CID/dir/ascii.txt | cut -d "/" -f3) &&
13 +ipfs dag export $ROOT_DIR_CID > fixtures.car
14 +
15 +echo ROOT_DIR_CID=${ROOT_DIR_CID} # ./
16 +echo FILE_CID=${FILE_CID} # ./dir/ascii.txt
17 +
18 +# ROOT_DIR_CID=bafybeie72edlprgtlwwctzljf6gkn2wnlrddqjbkxo3jomh4n7omwblxly # ./
19 +# FILE_CID=bafkreihhpc5y2pqvl5rbe5uuyhqjouybfs3rvlmisccgzue2kkt5zq6upq # ./dir/ascii.txt
20 +```
test/sharness/t0117-gateway-block/fixtures.car
Binary files /dev/null and b/test/sharness/t0117-gateway-block/fixtures.car differ