-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor Test Utils #329
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 Test Utils #329
Conversation
| close(t.ingress) | ||
| t.running.Wait() | ||
| } | ||
|
|
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.
This is just like the new code:
func (b *BasicNode) RecordMessageTypeSent(msg *simplex.Message) {
switch {
case msg.BlockMessage != nil:
b.messageTypesSent["BlockMessage"]++
case msg.VerifiedBlockMessage != nil:
b.messageTypesSent["VerifiedBlockMessage"]++
case msg.ReplicationRequest != nil:
b.messageTypesSent["ReplicationRequest"]++
case msg.ReplicationResponse != nil:
b.messageTypesSent["ReplicationResponse"]++
case msg.Notarization != nil:
b.messageTypesSent["VerifiedReplicationRequest"]++
case msg.VerifiedReplicationResponse != nil:
b.messageTypesSent["VerifiedReplicationResponse"]++
case msg.Finalization != nil:
b.messageTypesSent["NotarizationMessage"]++
case msg.FinalizeVote != nil:
b.messageTypesSent["FinalizationMessage"]++
case msg.VoteMessage != nil:
b.messageTypesSent["VoteMessage"]++
case msg.EmptyVoteMessage != nil:
b.messageTypesSent["EmptyVoteMessage"]++
case msg.EmptyNotarization != nil:
b.messageTypesSent["EmptyNotarization"]++
case msg.BlockDigestRequest != nil:
b.messageTypesSent["BlockDigestRequest"]++
default:
panic("unknown message type")
}
}
Was this file moved and then changed? or was the code just copied?
Is there a way to reduce the diff by git mv and then applying the code changes?
| @@ -0,0 +1,74 @@ | |||
| package long_running | |||
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.
license header
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.
added all
yacovm
left a comment
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.
can be merged after adding license header
This PR refactors the
testutilpackage to better decouple testing helpers and make it easier to compose custom networks, nodes, block builders, and related components.The refactor introduces a set of building blocks, such as
BasicNodeandBasicNetworkthat encapsulate shared responsibilities like epoch message handling, lifecycle management (start/stop), and essential helper functionality. These primitives can then be composed to build more specialized testing environments, such asLongRunningNetworkorControlledInMemoryNetwork.Specialized networks and nodes are responsible for their own additional behavior (e.g., custom block builders, node crash logic, or test-specific helpers), rather than inheriting unused functionality. This avoids the need for a single, monolithic network or node type that accumulates features required only by a subset of tests, keeping the test infrastructure more modular and extensible.