test: align health tests with immediate pool-disable behavior

This commit is contained in:
2026-08-18 19:33:07 -05:00
parent 1d063695fa
commit 2533f68d70
+5 -5
View File
@@ -74,20 +74,20 @@ class HealthCheckTest(unittest.TestCase):
self.assertEqual(result['last_action'], 'wlan1mon brought up')
self.assertIn(['ip', 'link', 'set', 'wlan1mon', 'up'], [r[0] for r in self.runs])
def test_down_with_no_sigsegv_growth_restarts_pineapd(self):
def test_down_disables_pool_regardless_of_sigsegv_history(self):
self.ping_ok = False
server._health['sigsegv_last'] = 4
result = server.health_check()
self.assertIn('pineapd restart', result['last_action'])
self.assertIn(['/etc/init.d/pineapd', 'restart'], [r[0] for r in self.runs])
self.assertIn('SSID pool broadcast disabled', result['last_action'])
self.assertEqual(self.uci_state['pineapd.@ssidpool[0].disable'], '1')
def test_fix_cooldown_prevents_thrash(self):
self.ping_ok = False
server._health['last_fix'] = server.time.time() - 30
server.health_check()
server.health_check()
fixes = [r for r in self.runs if r[0][0] in ('/etc/init.d/pineapd', 'ip', 'uci')]
self.assertEqual(len(fixes), 1, 'cooldown must allow only one fix action')
fixes = [r for r in self.runs if r[0][0] == '/etc/init.d/pineapd']
self.assertEqual(len(fixes), 1, 'cooldown must allow only one restart')
def test_health_endpoint_shape(self):
server._health['sigsegv_last'] = 7