Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test failure when updating to use upstream codecs which now enforce map entry sorting #3

Closed
warpfork opened this issue Aug 25, 2021 · 0 comments

Comments

@warpfork
Copy link
Contributor

warpfork commented Aug 25, 2021

I've attempted to bump the go-ipld-prime version in the go.mod file to v0.12.0 and found one test failure.

In brief

It appears to be related to stability of order of contents encoded by using dag-cbor. This changed in [email protected]: the dag-cbor codec now forces map key sorting when encoding. (Some people consider this a regression, and I frankly even agree, but have been out-voted on it.)

I suspect this isn't a major behavioural problem, and doesn't affect any downstreams, but a test failure is a test failure :)

The failure

The fulltext of the test failure is below:

--- FAIL: TestRoundTripArbitraryJOSE (1.70s)
    dagjose_test.go:463: [rapid] failed after 0 tests: (*T).FailNow() called
        To reproduce, specify -run="TestRoundTripArbitraryJOSE" -rapid.seed=1629884721185674694
        Failed test output:
    dagjose_test.go:464: [rapid] draw An arbitrary JOSE object: &dagjose.DagJOSE{payload:(*cid.Cid)(nil), signatures:[]dagjose.jwsSignature(nil), protected:[]uint8{}, unprotected:[]uint8{}, iv:[]uint8{}, aad:[]uint8(nil), ciphertext:[]uint8{}, tag:[]uint8(nil), recipients:[]dagjose.jweRecipient{dagjose.jweRecipient{header:map[string]ipld.Node{"":(*basicnode.plainMap)(0xc000c0da20)}, encrypted_key:[]uint8(nil)}}}
    dagjose_test.go:466:
                Error Trace:    dagjose_test.go:466
                                                        engine.go:203
                                                        engine.go:124
                                                        engine.go:74
                                                        dagjose_test.go:463
                Error:          Not equal:
                                expected: &dagjose.DagJOSE{payload:(*cid.Cid)(nil), signatures:[]dagjose.jwsSignature(nil), protected:[]uint8{}, unprotected:[]uint8{}, iv:[]uint8{}, aad:[]uint8(nil), ciphertext:[]uint8{}, tag:[]uint8(nil), recipients:[]dagjose.jweRecipient{dagjose.jweRecipient{header:map[string]ipld.Node{"":(*basicnode.plainMap)(0xc000c0da20)}, encrypted_key:[]uint8(nil)}}}
                                actual  : &dagjose.DagJOSE{payload:(*cid.Cid)(nil), signatures:[]dagjose.jwsSignature(nil), protected:[]uint8{}, unprotected:[]uint8{}, iv:[]uint8{}, aad:[]uint8(nil), ciphertext:[]uint8{}, tag:[]uint8(nil), recipients:[]dagjose.jweRecipient{dagjose.jweRecipient{header:map[string]ipld.Node{"":(*basicnode.plainMap)(0xc000c0dec0)}, encrypted_key:[]uint8(nil)}}}

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -23,8 +23,8 @@
                                       (basicnode.plainMap__Entry) {
                                +       k: (basicnode.plainString) "",
                                +       v: (*basicnode.plainString)("")
                                +      },
                                +      (basicnode.plainMap__Entry) {
                                        k: (basicnode.plainString) (len=1) "?",
                                        v: (*basicnode.plainString)(<already shown>)
                                -      },
                                -      (basicnode.plainMap__Entry) {
                                -       k: (basicnode.plainString) "",
                                -       v: (*basicnode.plainString)("")
                                       }
                Test:           TestRoundTripArbitraryJOSE

Recommendation

I suspect the correct action to do here is patch the test expectations to just have content which is in the canonical order that dag-cbor will now sort things into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant