@@ -275,18 +275,22 @@ private void upgradeDataStream(String dataStreamName, int numRolloversOnOldClust
275275 );
276276 assertOK (statusResponse );
277277 assertThat (statusResponseMap .get ("complete" ), equalTo (true ));
278- // The number of rollovers that will have happened when we call reindex:
279- final int rolloversPerformedByReindex = explicitRolloverOnNewClusterCount == 0 ? 1 : 0 ;
280278 final int originalWriteIndex = 1 ;
281- assertThat (
282- statusResponseMap .get ("total_indices_in_data_stream" ),
283- equalTo (originalWriteIndex + numRolloversOnOldCluster + explicitRolloverOnNewClusterCount + rolloversPerformedByReindex )
284- );
285279 if (isOriginalClusterSameMajorVersionAsCurrent ()) {
280+ assertThat (
281+ statusResponseMap .get ("total_indices_in_data_stream" ),
282+ equalTo (originalWriteIndex + numRolloversOnOldCluster + explicitRolloverOnNewClusterCount )
283+ );
286284 // If the original cluster was the same as this one, we don't want any indices reindexed:
287285 assertThat (statusResponseMap .get ("total_indices_requiring_upgrade" ), equalTo (0 ));
288286 assertThat (statusResponseMap .get ("successes" ), equalTo (0 ));
289287 } else {
288+ // The number of rollovers that will have happened when we call reindex:
289+ final int rolloversPerformedByReindex = explicitRolloverOnNewClusterCount == 0 ? 1 : 0 ;
290+ assertThat (
291+ statusResponseMap .get ("total_indices_in_data_stream" ),
292+ equalTo (originalWriteIndex + numRolloversOnOldCluster + explicitRolloverOnNewClusterCount + rolloversPerformedByReindex )
293+ );
290294 /*
291295 * total_indices_requiring_upgrade is made up of: (the original write index) + numRolloversOnOldCluster. The number of
292296 * rollovers on the upgraded cluster is irrelevant since those will not be reindexed.
0 commit comments