File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
x-pack/plugin/watcher/src
main/java/org/elasticsearch/xpack/watcher
test/java/org/elasticsearch/xpack/watcher Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -642,7 +642,10 @@ public void close() throws IOException {
642642 * @throws Exception
643643 */
644644 @ Override
645- public void reload (Settings settings ) throws Exception {
645+ public void reload (Settings settings ) {
646+ if (enabled == false || transportClient ) {
647+ return ;
648+ }
646649 for (NotificationService service : reloadableServices ) {
647650 service .reload (settings );
648651 }
Original file line number Diff line number Diff line change @@ -124,9 +124,9 @@ public synchronized void reload(Settings settings) {
124124 }
125125 }
126126
127- public void testReload () throws Exception {
127+ public void testReload () {
128128 Settings settings = Settings .builder ()
129- .put ("xpack.watcher.enabled" , false )
129+ .put ("xpack.watcher.enabled" , true )
130130 .put ("path.home" , createTempDir ())
131131 .build ();
132132 NotificationService mockService = mock (NotificationService .class );
@@ -138,4 +138,17 @@ public void testReload() throws Exception {
138138 watcher .reload (settings );
139139 verify (mockService , times (1 )).reload (settings );
140140 }
141+
142+ public void testReloadDisabled () {
143+ Settings settings = Settings .builder ()
144+ .put ("xpack.watcher.enabled" , false )
145+ .put ("path.home" , createTempDir ())
146+ .build ();
147+ NotificationService mockService = mock (NotificationService .class );
148+ Watcher watcher = new Watcher (settings );
149+
150+ verify (mockService , times (0 )).reload (settings );
151+ watcher .reload (settings );
152+ verify (mockService , times (0 )).reload (settings );
153+ }
141154}
You can’t perform that action at this time.
0 commit comments