@cryptotaxi247 / kubo / commits / 284bb8c81

test: use car fixtures in sharness t0116

Laurent Senta committed Feb 20, 2023 at 16:04 UTC 284bb8c819fbd8d50e757f733957980c183855b0
3 files changed +38 -7
test/sharness/t0116-gateway-cache.sh
+8 -7
@@ -25,15 +25,16 @@ test_launch_ipfs_daemon_without_network
25 # Caching of things like raw blocks, CARs, dag-json and dag-cbor
26 # is tested in their respective suites.
27
28 +# Import test case
29 +# See the static fixtures in ./t0116-gateway-cache/
30 test_expect_success "Add the test directory" '
29 - mkdir -p root2/root3/root4 &&
30 - echo "hello" > root2/root3/root4/index.html &&
31 - ROOT1_CID=$(ipfs add -Qrw --cid-version 1 root2)
32 - ROOT2_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2 | cut -d "/" -f3)
33 - ROOT3_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3 | cut -d "/" -f3)
34 - ROOT4_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3/root4 | cut -d "/" -f3)
35 - FILE_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3/root4/index.html | cut -d "/" -f3)
31 + ipfs dag import ../t0116-gateway-cache/fixtures.car
32 '
33 +ROOT1_CID=bafybeib3ffl2teiqdncv3mkz4r23b5ctrwkzrrhctdbne6iboayxuxk5ui # ./
34 +ROOT2_CID=bafybeih2w7hjocxjg6g2ku25hvmd53zj7og4txpby3vsusfefw5rrg5sii # ./root2
35 +ROOT3_CID=bafybeiawdvhmjcz65x5egzx4iukxc72hg4woks6v6fvgyupiyt3oczk5ja # ./root2/root3
36 +ROOT4_CID=bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q # ./root2/root3/root4
37 +FILE_CID=bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am # ./root2/root3/root4/index.html
38
39 test_expect_success "Prepare IPNS unixfs content path for testing" '
40 TEST_IPNS_ID=$(ipfs key gen --ipns-base=base36 --type=ed25519 cache_test_key | head -n1 | tr -d "\n")
test/sharness/t0116-gateway-cache/README.md new
+30
@@ -0,0 +1,30 @@
1 +# Dataset description/sources
2 +
3 +- fixtures.car
4 + - raw CARv1
5 +
6 +generated with:
7 +
8 +```sh
9 +mkdir -p root2/root3/root4 &&
10 +echo "hello" > root2/root3/root4/index.html &&
11 +ROOT1_CID=$(ipfs add -Qrw --cid-version 1 root2)
12 +ROOT2_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2 | cut -d "/" -f3)
13 +ROOT3_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3 | cut -d "/" -f3)
14 +ROOT4_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3/root4 | cut -d "/" -f3)
15 +FILE_CID=$(ipfs resolve -r /ipfs/$ROOT1_CID/root2/root3/root4/index.html | cut -d "/" -f3)
16 +
17 +echo ROOT1_CID=${ROOT1_CID}
18 +echo ROOT2_CID=${ROOT2_CID}
19 +echo ROOT3_CID=${ROOT3_CID}
20 +echo ROOT4_CID=${ROOT4_CID}
21 +echo FILE_CID=${FILE_CID}
22 +
23 +ipfs dag export ${ROOT1_CID} > ./fixtures.car
24 +
25 +# ROOT1_CID=bafybeib3ffl2teiqdncv3mkz4r23b5ctrwkzrrhctdbne6iboayxuxk5ui # ./
26 +# ROOT2_CID=bafybeih2w7hjocxjg6g2ku25hvmd53zj7og4txpby3vsusfefw5rrg5sii # ./root2
27 +# ROOT3_CID=bafybeiawdvhmjcz65x5egzx4iukxc72hg4woks6v6fvgyupiyt3oczk5ja # ./root2/root3
28 +# ROOT4_CID=bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q # ./root2/root3/root4
29 +# FILE_CID=bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am # ./root2/root3/root4/index.html
30 +```
test/sharness/t0116-gateway-cache/fixtures.car
Binary files /dev/null and b/test/sharness/t0116-gateway-cache/fixtures.car differ