Skip to content

Commit 2491e5d

Browse files
author
Sandeep Kumawat
committed
Fix flaky test RemotePrimaryLocalRecoveryIT
Signed-off-by: Sandeep Kumawat <[email protected]>
1 parent bf8cd25 commit 2491e5d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

server/src/internalClusterTest/java/org/opensearch/remotemigration/RemotePrimaryLocalRecoveryIT.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void testLocalRecoveryFlowWithReplicas() throws Exception {
111111
*/
112112
private void triggerRollingRestartForRemoteMigration(int replicaCount) throws Exception {
113113
internalCluster().startClusterManagerOnlyNodes(3);
114-
internalCluster().startNodes(numOfNodes - 3);
114+
internalCluster().startDataOnlyNodes(numOfNodes - 3);
115115

116116
// create index
117117
Settings indexSettings = Settings.builder()
@@ -133,13 +133,16 @@ private void triggerRollingRestartForRemoteMigration(int replicaCount) throws Ex
133133
REPOSITORY_2_NAME,
134134
translogRepoPath
135135
);
136-
internalCluster().rollingRestart(new InternalTestCluster.RestartCallback() {
137-
// Update remote attributes
138-
@Override
139-
public Settings onNodeStopped(String nodeName) {
140-
return remoteNodeAttributes;
141-
}
142-
});
136+
// restarts only data nodes.
137+
for (String nodeName : internalCluster().getDataNodeNames()) {
138+
internalCluster().restartNode(nodeName, new InternalTestCluster.RestartCallback() {
139+
// Update remote attributes
140+
@Override
141+
public Settings onNodeStopped(String nodeName) {
142+
return remoteNodeAttributes;
143+
}
144+
});
145+
}
143146
ensureStableCluster(numOfNodes);
144147
ensureGreen(TimeValue.timeValueSeconds(90), indexName);
145148
assertEquals(internalCluster().size(), numOfNodes);

0 commit comments

Comments
 (0)