Skip to content

Commit

Permalink
Update go-ipld-prime, revert tests to sorted-cbor forms
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Jul 30, 2021
1 parent 719a927 commit 70eed4e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ require (
github.com/ipfs/interface-go-ipfs-core v0.4.1-0.20210410030100-56c2e678cb62
github.com/ipld/go-car v0.3.1
github.com/ipld/go-codec-dagpb v1.2.1-0.20210405170603-d0b86f7623c2
github.com/ipld/go-ipld-prime v0.10.1-0.20210723093545-ebe39c7bab39
github.com/ipld/go-ipld-prime v0.10.1-0.20210727022528-083c39518830
github.com/jbenet/go-is-domain v1.0.5
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c
github.com/jbenet/go-temp-err-catcher v0.1.0
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,9 @@ github.com/ipld/go-codec-dagpb v1.2.1-0.20210405170603-d0b86f7623c2/go.mod h1:GM
github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.9.1-0.20210324083106-dc342a9917db/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.9.1-0.20210402181957-7406578571d1/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.10.1-0.20210723093545-ebe39c7bab39 h1:70/42k1tU7ZHuyjFDd7vbd6dgnMyFnC0fe8LKeF9ZPg=
github.com/ipld/go-ipld-prime v0.10.1-0.20210723093545-ebe39c7bab39/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.10.1-0.20210727022528-083c39518830 h1:tQyWv1pyxNIFe2hPczHGITClSQRJlW6dLIcEvkdSRgY=
github.com/ipld/go-ipld-prime v0.10.1-0.20210727022528-083c39518830/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=
github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
Expand Down
27 changes: 13 additions & 14 deletions test/sharness/t0053-dag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ test_expect_success "make a few test files" '
HASH4=$(ipfs add --pin=false -q file4)
'

# TODO: revert this ordering when https://github.com/ipld/go-ipld-prime/pull/204 is merged
# and we get dag-cbor map sorting
test_expect_success "make an ipld object in json" '
printf "{\"cats\":[{\"/\":\"%s\"},{\"water\":{\"/\":\"%s\"}}],\"hello\":\"world\",\"magic\":{\"/\":\"%s\"},\"subNode\":{\"beep\":[0,\"bop\"],\"dict\":\"ionary\"}}" $HASH1 $HASH2 $HASH3 > ipld_object
printf "{\"hello\":\"world\",\"cats\":[{\"/\":\"%s\"},{\"water\":{\"/\":\"%s\"}}],\"magic\":{\"/\":\"%s\"},\"sub\":{\"dict\":\"ionary\",\"beep\":[0,\"bop\"]}}" $HASH1 $HASH2 $HASH3 > ipld_object
'

test_expect_success "make the same ipld object in dag-cbor, dag-json and dag-pb" '
Expand All @@ -39,7 +37,8 @@ test_dag_cmd() {
'

test_expect_success "CID looks correct" '
EXPHASH="bafyreihim5n3etxp5om74fdpriqtys5sdmgbd5ix2oil7u2g2qfdpdlgie"
EXPHASH="bafyreiblwimnjbqcdoeafiobk6q27jcw64ew7n2fmmhdpldd63edmjecde"
echo $IPLDHASH > ipld_hash && \
test $EXPHASH = $IPLDHASH
'

Expand All @@ -48,7 +47,7 @@ test_dag_cmd() {
'

test_expect_success "CID looks correct" '
EXPHASH="bafyreihim5n3etxp5om74fdpriqtys5sdmgbd5ix2oil7u2g2qfdpdlgie"
EXPHASH="bafyreiblwimnjbqcdoeafiobk6q27jcw64ew7n2fmmhdpldd63edmjecde"
test $EXPHASH = $IPLDHASH
'

Expand Down Expand Up @@ -109,10 +108,10 @@ test_dag_cmd() {

test_expect_success "resolving sub-objects works" '
ipfs dag get $IPLDHASH/hello > sub1 &&
ipfs dag get $IPLDHASH/subNode > sub2 &&
ipfs dag get $IPLDHASH/subNode/beep > sub3 &&
ipfs dag get $IPLDHASH/subNode/beep/0 > sub4 &&
ipfs dag get $IPLDHASH/subNode/beep/1 > sub5
ipfs dag get $IPLDHASH/sub > sub2 &&
ipfs dag get $IPLDHASH/sub/beep > sub3 &&
ipfs dag get $IPLDHASH/sub/beep/0 > sub4 &&
ipfs dag get $IPLDHASH/sub/beep/1 > sub5
'

test_expect_success "sub-objects look right" '
Expand Down Expand Up @@ -184,9 +183,9 @@ test_dag_cmd() {
test_cmp cat_exp cat_out
'

test_expect_success "non-canonical cbor input is normalized" '
test_expect_success "non-canonical dag-cbor input is normalized" '
HASH=$(cat ../t0053-dag-data/non-canon.cbor | ipfs dag put --format=dag-cbor --input-enc=dag-cbor) &&
test $HASH = "bafyreicfngo3hexoxbbwsm64apbydw5fyeruyrfwiyxlj3f4wuzdyztd4m" ||
test $HASH = "bafyreiawx7ona7oa2ptcoh6vwq4q6bmd7x2ibtkykld327bgb7t73ayrqm" ||
test_fsh echo $HASH
'

Expand All @@ -204,12 +203,12 @@ test_dag_cmd() {
ipfs refs -r --timeout=2s $PINHASH > /dev/null
'

test_expect_success "can add an ipld object with sha3 hash" '
IPLDHASH=$(cat ipld_object | ipfs dag put --hash sha3)
test_expect_success "can add an ipld object with sha3-512 hash" '
IPLDHASH=$(cat ipld_object | ipfs dag put --hash sha3-512)
'

test_expect_success "output looks correct" '
EXPHASH="bafyriqdoys7rmgfkjg7jjdjdhaajt66vxjusd2ry6eims63xy5wwjtjgditq4z4f76tmnal5rccb4zg3o4zcud3utxulm7svoapq2du3xmnok"
EXPHASH="bafyriqforjma7y7akqz7nhuu73r6liggj5zhkbfiqgicywe3fgkna2ijlhod2af3ue7doj56tlzt5hh6iu5esafc4msr3sd53jol5m2o25ucy"
test $EXPHASH = $IPLDHASH
'

Expand Down

0 comments on commit 70eed4e

Please sign in to comment.