@@ -509,55 +509,33 @@ public void testSettingsAppliedOnMasterReElection() throws Exception {
509509
510510 public void testSymlinkUpdateTriggerReload () throws Exception {
511511 internalCluster ().setBootstrapMasterNodeIndex (0 );
512- logger .info ("--> start data node / non master node" );
513- String dataNode = internalCluster ().startNode (Settings .builder ().put (dataOnlyNode ()).put ("discovery.initial_state_timeout" , "1s" ));
514- FileSettingsService dataFileSettingsService = internalCluster ().getInstance (FileSettingsService .class , dataNode );
515-
516- assertFalse (dataFileSettingsService .watching ());
517-
518- logger .info ("--> start master node" );
519512 final String masterNode = internalCluster ().startMasterOnlyNode ();
520- assertMasterNode (internalCluster ().nonMasterClient (), masterNode );
513+ FileSettingsService masterFileSettingsService = internalCluster ().getInstance (FileSettingsService .class , masterNode );
514+ Path baseDir = masterFileSettingsService .watchedFileDir ();
515+ assertBusy (() -> assertTrue (masterFileSettingsService .watching ()));
516+
521517 {
522518 var savedClusterState = setupClusterStateListener (masterNode );
523-
524- FileSettingsService masterFileSettingsService = internalCluster ().getInstance (FileSettingsService .class , masterNode );
525-
526- assertBusy (() -> assertTrue (masterFileSettingsService .watching ()));
527- assertFalse (dataFileSettingsService .watching ());
528-
529519 // Create the settings.json as a symlink to simulate k8 setup
530520 // settings.json -> ..data/settings.json
531521 // ..data -> ..TIMESTAMP_TEMP_FOLDER_1
532- createK8sLikeSymlinks (masterNode );
522+ var fileDir = Files .createDirectories (baseDir .resolve ("..TIMESTAMP_TEMP_FOLDER_1" ));
523+ writeJSONFile (masterNode , testJSON , logger , versionCounter .incrementAndGet (), fileDir .resolve ("settings.json" ));
524+ var dataDir = Files .createSymbolicLink (baseDir .resolve ("..data" ), fileDir .getFileName ());
525+ Files .createSymbolicLink (baseDir .resolve ("settings.json" ), dataDir .getFileName ().resolve ("settings.json" ));
533526 assertClusterStateSaveOK (savedClusterState .v1 (), savedClusterState .v2 (), "50mb" );
534527 }
535528 {
536529 var savedClusterState = setupClusterStateListener (masterNode );
537530 // Update ..data symlink to ..data -> ..TIMESTAMP_TEMP_FOLDER_2 to simulate kubernetes secret update
538- updateSymlinks (masterNode , testJSON43mb );
531+ var fileDir = Files .createDirectories (baseDir .resolve ("..TIMESTAMP_TEMP_FOLDER_2" ));
532+ writeJSONFile (masterNode , testJSON43mb , logger , versionCounter .incrementAndGet (), fileDir .resolve ("settings.json" ));
533+ Files .deleteIfExists (baseDir .resolve ("..data" ));
534+ Files .createSymbolicLink (baseDir .resolve ("..data" ), fileDir .getFileName ());
539535 assertClusterStateSaveOK (savedClusterState .v1 (), savedClusterState .v2 (), "43mb" );
540536 }
541537 }
542538
543- public Path createK8sLikeSymlinks (String node ) throws Exception {
544- FileSettingsService fileSettingsService = internalCluster ().getInstance (FileSettingsService .class , node );
545- Path baseDir = fileSettingsService .watchedFileDir ();
546- var fileDir = Files .createDirectories (baseDir .resolve ("..TIMESTAMP_TEMP_FOLDER_1" ));
547- writeJSONFile (node , testJSON , logger , versionCounter .incrementAndGet (), fileDir .resolve ("settings.json" ));
548- var dataDir = Files .createSymbolicLink (baseDir .resolve ("..data" ), fileDir .getFileName ());
549- return Files .createSymbolicLink (baseDir .resolve ("settings.json" ), dataDir .getFileName ().resolve ("settings.json" ));
550- }
551-
552- public void updateSymlinks (String node , String json ) throws Exception {
553- FileSettingsService fileSettingsService = internalCluster ().getInstance (FileSettingsService .class , node );
554- Path baseDir = fileSettingsService .watchedFileDir ();
555- var fileDir = Files .createDirectories (baseDir .resolve ("..TIMESTAMP_TEMP_FOLDER_2" ));
556- writeJSONFile (node , json , logger , versionCounter .incrementAndGet (), fileDir .resolve ("settings.json" ));
557- Files .deleteIfExists (baseDir .resolve ("..data" ));
558- Files .createSymbolicLink (baseDir .resolve ("..data" ), fileDir .getFileName ());
559- }
560-
561539 public void testHealthIndicatorWithSingleNode () throws Exception {
562540 internalCluster ().setBootstrapMasterNodeIndex (0 );
563541 logger .info ("--> start the node" );
0 commit comments