File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -269,7 +269,12 @@ case "$COMMAND" in
269269 fi
270270
271271 if [[ " $ENABLE_EXTERNAL_SIGNALS " == " 1" && " $now " -ge " $next_external " ]]; then
272+ before_sig=" $( file_sig " $WATCHLIST " ) "
272273 run_logged external-signals scripts/refresh_external_signals.sh
274+ after_sig=" $( file_sig " $WATCHLIST " ) "
275+ if [[ " $before_sig " != " $after_sig " ]]; then
276+ restart_monitor
277+ fi
273278 next_external=$(( now + EXTERNAL_SIGNALS_INTERVAL))
274279 fi
275280
Original file line number Diff line number Diff line change 1+ import unittest
2+ from pathlib import Path
3+
4+
5+ class BackgroundManagerScriptTests (unittest .TestCase ):
6+ def test_external_signal_refresh_restarts_monitor_when_watchlist_changes (self ):
7+ root = Path (__file__ ).resolve ().parents [1 ]
8+ text = (root / "scripts" / "background_manager.sh" ).read_text ()
9+ block = text .split ('if [[ "$ENABLE_EXTERNAL_SIGNALS" == "1"' )[1 ].split (
10+ 'if [[ "$ENABLE_DISCOVERY_REFRESH" == "1"'
11+ )[0 ]
12+
13+ self .assertIn ('before_sig="$(file_sig "$WATCHLIST")"' , block )
14+ self .assertIn ('after_sig="$(file_sig "$WATCHLIST")"' , block )
15+ self .assertIn ('if [[ "$before_sig" != "$after_sig" ]]' , block )
16+ self .assertIn ("restart_monitor" , block )
17+
18+
19+ if __name__ == "__main__" :
20+ unittest .main ()
You can’t perform that action at this time.
0 commit comments