test(event): Move more event store tests to shared_examples
#4500
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.
Context
b3131f4 introduced a
shared_examplesto improve consistency between the event stores tests. The following methods were not tested in theshared_examplesthough:prorated_events_valuesprorated_sumgrouped_prorated_sumweighted_sumgrouped_weighted_sumprorated_unique_countgrouped_prorated_unique_countprorated_unique_count_breakdownFurthermore, the
weighted_sum_breakdownmethod was not tested.Description
This moves the following methods tests to the
shared_examples:prorated_events_valuesprorated_sumgrouped_prorated_sumweighted_sumgrouped_weighted_sumTests were also added for the
weighted_sum_breakdownmethod.It looks like the behavior of the prorated unique count methods actually differs from the Postgres and Clickhouse stores so they were not moved to the
shared_examples.This also fixes an issue with the
weighted_sum_breakdownmethod of the Clickhouse store which returned thesecond_durationas string rather than int. That's becausedate_diffactually returns anInt64and ActiveRecord transform that into aStringso we call#to_ito ensure consistency between implementations:Note that the
weighted_sum_breakdownmethod of the Clickhouse stores returns timestamps with a 5 decimal precision rather than 3 as in the other methods.