@@ -201,6 +201,42 @@ private static ClusterState state(DiscoveryNode localNode, String[] acceptedConf
201201 .lastCommittedConfiguration (config (committedConfig )).build ())).build ();
202202 }
203203
204+
205+ public void testDescriptionAfterDetachCluster () {
206+ final DiscoveryNode localNode = new DiscoveryNode ("local" , buildNewFakeTransportAddress (), Version .CURRENT );
207+
208+ final ClusterState clusterState = state (localNode ,
209+ VotingConfiguration .MUST_JOIN_ELECTED_MASTER .getNodeIds ().toArray (new String [0 ]));
210+
211+ assertThat (new ClusterFormationState (Settings .EMPTY , clusterState , emptyList (), emptyList (), 0L ).getDescription (),
212+ is ("master not discovered yet and this node was detached from its previous cluster, " +
213+ "have discovered []; " +
214+ "discovery will continue using [] from hosts providers and [" + localNode +
215+ "] from last-known cluster state; node term 0, last-accepted version 0 in term 0" ));
216+
217+ final TransportAddress otherAddress = buildNewFakeTransportAddress ();
218+ assertThat (new ClusterFormationState (Settings .EMPTY , clusterState , singletonList (otherAddress ), emptyList (), 0L ).getDescription (),
219+ is ("master not discovered yet and this node was detached from its previous cluster, " +
220+ "have discovered []; " +
221+ "discovery will continue using [" + otherAddress + "] from hosts providers and [" + localNode +
222+ "] from last-known cluster state; node term 0, last-accepted version 0 in term 0" ));
223+
224+ final DiscoveryNode otherNode = new DiscoveryNode ("otherNode" , buildNewFakeTransportAddress (), Version .CURRENT );
225+ assertThat (new ClusterFormationState (Settings .EMPTY , clusterState , emptyList (), singletonList (otherNode ), 0L ).getDescription (),
226+ is ("master not discovered yet and this node was detached from its previous cluster, " +
227+ "have discovered [" + otherNode + "]; " +
228+ "discovery will continue using [] from hosts providers and [" + localNode +
229+ "] from last-known cluster state; node term 0, last-accepted version 0 in term 0" ));
230+
231+ final DiscoveryNode yetAnotherNode = new DiscoveryNode ("yetAnotherNode" , buildNewFakeTransportAddress (), Version .CURRENT );
232+ assertThat (new ClusterFormationState (Settings .EMPTY , clusterState , emptyList (), singletonList (yetAnotherNode ), 0L ).getDescription (),
233+ is ("master not discovered yet and this node was detached from its previous cluster, " +
234+ "have discovered [" + yetAnotherNode + "]; " +
235+ "discovery will continue using [] from hosts providers and [" + localNode +
236+ "] from last-known cluster state; node term 0, last-accepted version 0 in term 0" ));
237+
238+ }
239+
204240 public void testDescriptionAfterBootstrapping () {
205241 final DiscoveryNode localNode = new DiscoveryNode ("local" , buildNewFakeTransportAddress (), Version .CURRENT );
206242
0 commit comments