Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.