-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Zen2: Add DisruptableMockTransport #33713
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
Conversation
Pinging @elastic/es-distributed |
@elasticmachine retest this please |
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.
Very nice. I left a handful of suggestions (and the build still fails) but all are optional.
} | ||
|
||
|
||
static class DummyRequest extends TransportRequest { |
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.
Why not TransportRequest.Empty
?
} | ||
|
||
protected void onSendRequest(long requestId, String action, TransportRequest request, DiscoveryNode node) { | ||
requests.put(requestId, Tuple.tuple(node, action)); |
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.
All the implementations call super(...)
up front, and I think it'd be bad not to, so I think it'd be better to move this into sendRequest()
above.
private TransportMessageListener listener; | ||
private ConcurrentMap<Long, Tuple<DiscoveryNode, String>> requests = new ConcurrentHashMap<>(); | ||
|
||
public TransportService createTransportService(Settings settings, ThreadPool threadPool, TransportInterceptor interceptor, |
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.
The newly-merged CoordinatorTests also call this method with its old name.
|
||
@Override | ||
public String getChannelType() { | ||
return "test-channel"; |
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.
Not sure where this string appears, but something more specific might be useful. Maybe disruptable-mock-transport-channel
?
}; | ||
|
||
try { | ||
requestHandler.processMessageReceived(request, transportChannel); |
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.
IntelliJ complains about lack of genericness for this call. Could it move to its own method on which such warnings are suppressed?
Adds a mock transport implementation that allows to simulate network disruptions.