@@ -281,18 +281,22 @@ private void upgradeDataStream(String dataStreamName, int numRolloversOnOldClust
281281 );
282282 assertOK (statusResponse );
283283 assertThat (statusResponseMap .get ("complete" ), equalTo (true ));
284- // The number of rollovers that will have happened when we call reindex:
285- final int rolloversPerformedByReindex = explicitRolloverOnNewClusterCount == 0 ? 1 : 0 ;
286284 final int originalWriteIndex = 1 ;
287- assertThat (
288- statusResponseMap .get ("total_indices_in_data_stream" ),
289- equalTo (originalWriteIndex + numRolloversOnOldCluster + explicitRolloverOnNewClusterCount + rolloversPerformedByReindex )
290- );
291285 if (isOriginalClusterSameMajorVersionAsCurrent ()) {
286+ assertThat (
287+ statusResponseMap .get ("total_indices_in_data_stream" ),
288+ equalTo (originalWriteIndex + numRolloversOnOldCluster + explicitRolloverOnNewClusterCount )
289+ );
292290 // If the original cluster was the same as this one, we don't want any indices reindexed:
293291 assertThat (statusResponseMap .get ("total_indices_requiring_upgrade" ), equalTo (0 ));
294292 assertThat (statusResponseMap .get ("successes" ), equalTo (0 ));
295293 } else {
294+ // The number of rollovers that will have happened when we call reindex:
295+ final int rolloversPerformedByReindex = explicitRolloverOnNewClusterCount == 0 ? 1 : 0 ;
296+ assertThat (
297+ statusResponseMap .get ("total_indices_in_data_stream" ),
298+ equalTo (originalWriteIndex + numRolloversOnOldCluster + explicitRolloverOnNewClusterCount + rolloversPerformedByReindex )
299+ );
296300 /*
297301 * total_indices_requiring_upgrade is made up of: (the original write index) + numRolloversOnOldCluster. The number of
298302 * rollovers on the upgraded cluster is irrelevant since those will not be reindexed.
0 commit comments