-
Notifications
You must be signed in to change notification settings - Fork 205
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
Refactor trigger rule simulation lib #16645
Conversation
|
||
trait CatGenerators { | ||
|
||
protected def packageId: PackageId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We allow call/use sites to set the package ID
applicationId, | ||
triggerParties, | ||
) | ||
class SimulationContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SimulationContext
allows core state to be used on a per test basis
@@ -63,20 +50,6 @@ class TriggerRuleSimulationLibTest | |||
.copy(allowTriggerTimeouts = true, allowInFlightCommandOverflows = true) | |||
) | |||
|
|||
def forAll[T](gen: Gen[T], sampleSize: Int = 100, parallelism: Int = 1)( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into TriggerRuleSimulationLib
for reuse elsewhere
private[this] val metricCountData = mutable.Map.empty[Set[UUID], mutable.Map[String, Long]] | ||
private[this] val metricTimingData = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not notice that before but why are we using a mutable data structure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed this point offline and have decided to not alter the code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Refactor trigger rule simulation library as follows:
TriggerRuleSimulation
so that code can be ran on async workloads (useful for trigger resource and multi-process trigger simulation tests)CatGenerators
into a trait so that they may be reused across tests (again useful for trigger resource and multi-process simulation tests)