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

feat: Introduce the 'Assert' sink #140

Merged
merged 7 commits into from
Feb 14, 2022
Merged

feat: Introduce the 'Assert' sink #140

merged 7 commits into from
Feb 14, 2022

Conversation

scarmuega
Copy link
Member

@scarmuega scarmuega commented Feb 14, 2022

With the goal of moving towards a CD pipeline, we introduce a new Assert sink.

The sink works by consuming incoming events and running an expanding set of "assertions" for each one. The result of the assertions are logged. If specified via configuration, a failed assertion will panic and terminate the pipeline (useful for automation).

In this initial PR we're including the following set of assertions:

block_depth_doesnt_skip_numbers
block_slot_increases
block_previous_hash_matches
event_timestamp_increases
tx_records_matches_block_count

Ideally, we'll keep growing the list with more specific checks for each event. There's also room for adding checks that include well-known, expected values (aka: asserting values for particular blocks).

The end-goal is to have a comprehensive set of assertions that can be used in automated integration tests, providing a fast mechanism for catching regressions on each new PR.

Implementation details:

  • the sink maintains a state object which is the result of a "reduce" algorithm over the previous state and the current event. This is required since many of the interesting checks involve looking into the history of past events.
  • we use macros to improve readability without sacrifying static dispatches.

@scarmuega scarmuega added enhancement New feature or request automation labels Feb 14, 2022
@scarmuega scarmuega added this to the v1.2 milestone Feb 14, 2022
@scarmuega scarmuega self-assigned this Feb 14, 2022
@scarmuega scarmuega marked this pull request as ready for review February 14, 2022 02:41
@scarmuega scarmuega merged commit 2d29eab into main Feb 14, 2022
@scarmuega scarmuega deleted the feat/assert branch February 14, 2022 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant