Fix CCR tests that manipulate transport requests
We have some CCR tests where we use mock transport send rules to control the behavior that we desire in these tests. Namely, we want to simulate an exception being thrown on the leader side, or a variety of other situations. These send rules were put in place between the data nodes on each side. However, it might not be the case that these requests are being sent between data nodes. For example, a request that is handled on a non-data master node would not be sent from a data node. And it might not be the case that the request is sent to a data node, as it could be proxied through a non-data coordinating node. This commit addresses this by putting these send rules in places between all nodes on each side. Closes #39011 Closes #39201
This commit is contained in:
parent
fc896e452c
commit
719c38a36d
|
@ -190,7 +190,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
|||
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/39011")
|
||||
public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
|
||||
final String leaderIndex = "leader";
|
||||
final int numberOfShards = randomIntBetween(1, 3);
|
||||
|
@ -206,11 +205,11 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
|||
|
||||
// block the recovery from completing; this ensures the background sync is still running
|
||||
final ClusterStateResponse followerClusterState = followerClient().admin().cluster().prepareState().clear().setNodes(true).get();
|
||||
for (final ObjectCursor<DiscoveryNode> senderNode : followerClusterState.getState().nodes().getDataNodes().values()) {
|
||||
for (final ObjectCursor<DiscoveryNode> senderNode : followerClusterState.getState().nodes().getNodes().values()) {
|
||||
final MockTransportService senderTransportService =
|
||||
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
|
||||
final ClusterStateResponse leaderClusterState = leaderClient().admin().cluster().prepareState().clear().setNodes(true).get();
|
||||
for (final ObjectCursor<DiscoveryNode> receiverNode : leaderClusterState.getState().nodes().getDataNodes().values()) {
|
||||
for (final ObjectCursor<DiscoveryNode> receiverNode : leaderClusterState.getState().nodes().getNodes().values()) {
|
||||
final MockTransportService receiverTransportService =
|
||||
(MockTransportService) getLeaderCluster().getInstance(TransportService.class, receiverNode.value.getName());
|
||||
senderTransportService.addSendBehavior(receiverTransportService,
|
||||
|
@ -401,12 +400,12 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
|||
|
||||
final ClusterStateResponse followerClusterState = followerClient().admin().cluster().prepareState().clear().setNodes(true).get();
|
||||
try {
|
||||
for (final ObjectCursor<DiscoveryNode> senderNode : followerClusterState.getState().nodes().getDataNodes().values()) {
|
||||
for (final ObjectCursor<DiscoveryNode> senderNode : followerClusterState.getState().nodes().getNodes().values()) {
|
||||
final MockTransportService senderTransportService =
|
||||
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
|
||||
final ClusterStateResponse leaderClusterState =
|
||||
leaderClient().admin().cluster().prepareState().clear().setNodes(true).get();
|
||||
for (final ObjectCursor<DiscoveryNode> receiverNode : leaderClusterState.getState().nodes().getDataNodes().values()) {
|
||||
for (final ObjectCursor<DiscoveryNode> receiverNode : leaderClusterState.getState().nodes().getNodes().values()) {
|
||||
final MockTransportService receiverTransportService =
|
||||
(MockTransportService) getLeaderCluster().getInstance(TransportService.class, receiverNode.value.getName());
|
||||
senderTransportService.addSendBehavior(receiverTransportService,
|
||||
|
@ -467,7 +466,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/39201")
|
||||
public void testUnfollowFailsToRemoveRetentionLeases() throws Exception {
|
||||
final String leaderIndex = "leader";
|
||||
final String followerIndex = "follower";
|
||||
|
@ -491,12 +489,12 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
|||
|
||||
final ClusterStateResponse followerClusterState = followerClient().admin().cluster().prepareState().clear().setNodes(true).get();
|
||||
try {
|
||||
for (final ObjectCursor<DiscoveryNode> senderNode : followerClusterState.getState().nodes().getDataNodes().values()) {
|
||||
for (final ObjectCursor<DiscoveryNode> senderNode : followerClusterState.getState().nodes().getNodes().values()) {
|
||||
final MockTransportService senderTransportService =
|
||||
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
|
||||
final ClusterStateResponse leaderClusterState =
|
||||
leaderClient().admin().cluster().prepareState().clear().setNodes(true).get();
|
||||
for (final ObjectCursor<DiscoveryNode> receiverNode : leaderClusterState.getState().nodes().getDataNodes().values()) {
|
||||
for (final ObjectCursor<DiscoveryNode> receiverNode : leaderClusterState.getState().nodes().getNodes().values()) {
|
||||
final MockTransportService receiverTransportService =
|
||||
(MockTransportService) getLeaderCluster().getInstance(TransportService.class, receiverNode.value.getName());
|
||||
senderTransportService.addSendBehavior(receiverTransportService,
|
||||
|
|
Loading…
Reference in New Issue