@@ -68,29 +68,25 @@ public void testRepurpose() throws Exception {
6868 );
6969
7070 logger .info ("--> Repurposing node 1" );
71- executeRepurposeCommandForOrdinal (noMasterNoDataSettings , indexUUID , 1 );
71+ executeRepurposeCommandForOrdinal (noMasterNoDataSettings , indexUUID , 1 , 1 );
7272
7373 ElasticsearchException lockedException = expectThrows (ElasticsearchException .class ,
74- () -> executeRepurposeCommandForOrdinal (noMasterNoDataSettings , indexUUID , 0 )
74+ () -> executeRepurposeCommandForOrdinal (noMasterNoDataSettings , indexUUID , 0 , 1 )
7575 );
7676
7777 assertThat (lockedException .getMessage (), containsString (NodeRepurposeCommand .FAILED_TO_OBTAIN_NODE_LOCK_MSG ));
7878
7979 logger .info ("--> Starting node after repurpose" );
8080 internalCluster ().startCoordinatingOnlyNode (Settings .EMPTY );
8181
82- ensureGreen ();
83-
84- // docs gone
85- assertFalse (client ().prepareGet (indexName , "type1" , "1" ).get ().isExists ());
8682 assertTrue (indexExists (indexName ));
8783
8884 logger .info ("--> Restarting and repurposing other node" );
8985
9086 internalCluster ().stopRandomNode (s -> true );
9187 internalCluster ().stopRandomNode (s -> true );
9288
93- executeRepurposeCommandForOrdinal (noMasterNoDataSettings , indexUUID , 0 );
89+ executeRepurposeCommandForOrdinal (noMasterNoDataSettings , indexUUID , 0 , 0 );
9490
9591 internalCluster ().startMasterOnlyNode ();
9692 internalCluster ().startDataOnlyNode ();
@@ -101,12 +97,13 @@ public void testRepurpose() throws Exception {
10197 assertFalse (indexExists (indexName ));
10298 }
10399
104- private void executeRepurposeCommandForOrdinal (Settings settings , String indexUUID , int ordinal ) throws Exception {
100+ private void executeRepurposeCommandForOrdinal (Settings settings , String indexUUID , int ordinal ,
101+ int expectedShardCount ) throws Exception {
105102 boolean verbose = randomBoolean ();
106103 Settings settingsWithPath = Settings .builder ().put (internalCluster ().getDefaultSettings ()).put (settings ).build ();
107104 int expectedIndexCount = TestEnvironment .newEnvironment (settingsWithPath ).dataFiles ().length ;
108105 Matcher <String > matcher = allOf (
109- containsString (NodeRepurposeCommand .noMasterMessage (1 , 1 , expectedIndexCount )),
106+ containsString (NodeRepurposeCommand .noMasterMessage (1 , expectedShardCount , expectedIndexCount )),
110107 not (contains (NodeRepurposeCommand .PRE_V7_MESSAGE )),
111108 NodeRepurposeCommandTests .conditionalNot (containsString (indexUUID ), verbose == false ));
112109 NodeRepurposeCommandTests .verifySuccess (settingsWithPath , matcher ,
0 commit comments