hirosystems / chainhook

Extract transactions from Stacks and Bitcoin and build event driven re-org resistant indexers and databases.
GNU General Public License v3.0
143 stars 57 forks source link

Chainhooks Productionized: Increase test coverage #287

Open lgalabru opened 1 year ago

lgalabru commented 1 year ago

Include unit tests for predicates discussed in README.

Target coverage %: 80+ for core (predicate eval, standardizing block)

sabbyanandan commented 1 year ago

Perhaps addressed via @MicaiahReid incredible test harness via https://github.com/hirosystems/chainhook/pull/344/files? (+433 −9 -> woot!)

MicaiahReid commented 1 year ago

@sabbyanandan You'd think all of that code would add some test coverage, but I only actually increased our coverage by 1.7%! 😅

My PR covers a lot of surface area in terms of ensuring we don't accidentally have breaking changes in the API to register a new chainhook. However, it does not yet go very deep in testing code paths and the results of registering a chainhook.

I'm hopeful that my PR has set the ground work to make it easier to increase code coverage, and I know it will be a huge help to the platform team that we no longer accidentally break the API for them, but we'll still need to invest some more time to get higher code coverage. I believe we're at about 20% for the whole repo.

sabbyanandan commented 1 year ago

we no longer accidentally break the API

Heck yeah! Thank you for the thoughtful progress here. And yes, we can, and we will keep this a priority and incrementally get better at it.

timstackblock commented 1 year ago

I have pushed up my test here https://github.com/hirosystems/chainhook/pull/347#issuecomment-1660404718 some predicate testing is blocked by the corresponding bugs I created issues for, the test are present but they fail as the predicate brings back data that is outside the scope of the block parameter or the asset identifier. I have highlighted this on the conversation for the pull request.

I also noticed that I am getting a different response for the file append results and the POST result for the contract call predicate its really weird because the predicate parameter are exactly the same but the results are different. I will create a bug for this as well, as a result of this issue the POST test for the contract call fails while the file append passes.