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

Introduce tests using fixtures from the ipld/ipld repo. #24

Merged
merged 2 commits into from
Nov 19, 2021

Conversation

warpfork
Copy link
Contributor

@warpfork warpfork commented Nov 19, 2021

Description

I've added fixtures for dag-jose to the ipld/ipld repo. This diff adds code to run them; and a git submodule which drags in the ipld/ipld repo (so we've got something to run).

The fixtures themselves are materially the same as some other fixtures already used in another repo, but I've put them in a new format, and added some more kinds of related fixtures which I hope will increase legibility significantly.

The code both runs the test fixtures, and is also capable of regenerating them (or at least, some of them -- not the initial dag-jose itself (where would it come from?)). To do the later, simply run go test ./dagjose/ -testmark.regen. (This is quite literally how I produced the rest of the data in ipld/ipld#151 .)

(A git submodule? Yes. I think this is the least bad way to solve this linkage. Counterproposals welcome, though. I know many people don't consider them a joy to maintain.)

How Has This Been Tested?

The entire PR is tests :)

For the data: seealso ipld/ipld#151 . (That review is probably more critical than this one!)

Definition of Done

Before submitting this PR, please make sure:

  • The work addresses the description and outcomes in the issue
  • I have added relevant tests for new or updated functionality
  • My code follows conventions, is well commented, and easy to understand
  • My code builds and tests pass without any errors or warnings
  • I have tagged the relevant reviewers
  • I have updated the READMEs of affected packages
  • I have made corresponding changes to the documentation
  • The changes have been communicated to interested parties

@warpfork
Copy link
Contributor Author

Oh, I should also mention -- I added github.com/frankban/quicktest as a dependency for testing. I like it because it provides diffs when making checks on strings, and that produces very useful output. But any other assertion function would work too, and I'm not attached to that part.

@warpfork
Copy link
Contributor Author

@smrz2001 I think this is mostly for your review.

See commit message in the linked commit in the ipld/ipld submodule.

(Calling both the dagjose and the dagjson hunks "data", as it was
previously, suggested incorrect things: they are not that similar.
The dagjson is the datamodel view, and that is *not* the same thing
as a transliteration of the tokens that you'd get if you parsed the
dag-jose as dag-cbor.)
@smrz2001
Copy link
Collaborator

Thanks so much, @warpfork!

@smrz2001
Copy link
Collaborator

I'm going to merge this in and test/finalize it all together in #23

@smrz2001 smrz2001 merged commit 42cd9eb into ceramicnetwork:feat/dagjose-schema Nov 19, 2021
@warpfork warpfork deleted the testing branch November 19, 2021 11:50
smrz2001 added a commit that referenced this pull request Nov 26, 2021
* feat: `dag-jose` implementation using IPLD schema/code generation

* cleanup

* support for "flattened" JOSE objects

* updates from review

* comments and renaming

* validate (then ignore) `link` when encoding

* updates and test fixes

* first pass of unit tests

* update dependencies

* test fixes

* Introduce tests using fixtures from the ipld/ipld repo. (#24)

* Introduce tests using fixtures from the ipld/ipld repo.

* tweak some fixture hunk names.

See commit message in the linked commit in the ipld/ipld submodule.

(Calling both the dagjose and the dagjson hunks "data", as it was
previously, suggested incorrect things: they are not that similar.
The dagjson is the datamodel view, and that is *not* the same thing
as a transliteration of the tokens that you'd get if you parsed the
dag-jose as dag-cbor.)

* test fixes

* test fixes

* test fixes

* test fixes

* cleanup docs

* remove `link` from encoded JWS

* fix up tests

* minor updates and add TODOs

* add CID matching to spec tests

* remove travis.yml file and add TODOs to README.md

* Update spec_test.go

Remove redundant code

* updates from review

* update to latest ipld repo

* use newest go-ipld-prime

* check err from traversal

Co-authored-by: Eric Myhre <hash@exultant.us>
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

Successfully merging this pull request may close these issues.

2 participants