fix(reliability): supervisor re-parks stock-resurrected dummy STA on interval
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'payload', 'user', 'remote_access', 'pager-webui'))
|
||||
import server
|
||||
@@ -150,6 +151,25 @@ class SupervisorExtrasTest(unittest.TestCase):
|
||||
open(path, 'w').write(content)
|
||||
self.assertEqual(server._mem_percent(path), 60)
|
||||
|
||||
def test_health_reparks_resurrected_dummy_sta(self):
|
||||
server._health['ticks'] = server.HEALTH_STA_PARK_INTERVAL - 1
|
||||
with mock.patch.object(
|
||||
server, '_sta_uplink_enabled', return_value=True), \
|
||||
__import__('unittest').mock.patch.object(
|
||||
server, '_park_dummy_sta') as park:
|
||||
h = server.health_check()
|
||||
park.assert_called_once()
|
||||
self.assertEqual(server._health['ticks'],
|
||||
server.HEALTH_STA_PARK_INTERVAL)
|
||||
# not on interval ticks: no re-park
|
||||
server._health['ticks'] = 1
|
||||
with mock.patch.object(
|
||||
server, '_sta_uplink_enabled', return_value=True), \
|
||||
__import__('unittest').mock.patch.object(
|
||||
server, '_park_dummy_sta') as park:
|
||||
server.health_check()
|
||||
park.assert_not_called()
|
||||
|
||||
def test_health_reports_events_and_counters(self):
|
||||
import mk8_events
|
||||
mk8_events.log_event('restart', msg='x')
|
||||
|
||||
Reference in New Issue
Block a user