Refactor ledd daemon and fix high CPU usage due to unexpected socket … #548
Build #20241010.2 had test failures
Details
- Failed: 4 (14.81%)
- Passed: 23 (85.19%)
- Other: 0 (0.00%)
- Total: 27
Annotations
Check failure on line 290 in Build log
azure-pipelines / Azure.sonic-platform-daemons
Build log #L290
Bash exited with code '1'.
Check failure on line 19 in Build log
azure-pipelines / Azure.sonic-platform-daemons
Build log #L19
There are one or more test failures detected in result files. Detailed summary of published test results can be viewed in the Tests tab.
Check failure on line 1 in test_run_select_timeout
azure-pipelines / Azure.sonic-platform-daemons
test_run_select_timeout
assert 0 == 1 +0 -1
Raw output
self = <tests.test_ledd.TestDaemonLedd object at 0x7fec14fc1610>
mock_select = <MagicMock name='Select' id='140651941074880'>
mock_sst = <MagicMock name='SubscriberStateTable' id='140651940297840'>
mock_load_plat_util = <MagicMock name='load_platform_util' id='140651940309888'>
@mock.patch("ledd.DaemonLedd.load_platform_util")
@mock.patch("ledd.swsscommon.SubscriberStateTable")
@mock.patch("ledd.swsscommon.Select")
def test_run_select_timeout(self, mock_select, mock_sst, mock_load_plat_util):
select_instance = mock_select.return_value
select_instance.select.return_value = (ledd.swsscommon.Select.TIMEOUT, None)
daemon_ledd = ledd.DaemonLedd()
ret = daemon_ledd.run()
> assert ret == 1
E assert 0 == 1
E +0
E -1
tests/test_ledd.py:77: AssertionError
Check failure on line 1 in test_run_bad_select_return
azure-pipelines / Azure.sonic-platform-daemons
test_run_bad_select_return
assert -1 == 2 +-1 -2
Raw output
self = <tests.test_ledd.TestDaemonLedd object at 0x7fec14f3b6a0>
mock_select = <MagicMock name='Select' id='140651940524624'>
mock_sst = <MagicMock name='SubscriberStateTable' id='140651940529200'>
mock_load_plat_util = <MagicMock name='load_platform_util' id='140651940521440'>
@mock.patch("ledd.DaemonLedd.load_platform_util")
@mock.patch("ledd.swsscommon.SubscriberStateTable")
@mock.patch("ledd.swsscommon.Select")
def test_run_bad_select_return(self, mock_select, mock_sst, mock_load_plat_util):
select_instance = mock_select.return_value
select_instance.select.return_value = (ledd.swsscommon.Select.ERROR, mock.MagicMock())
daemon_ledd = ledd.DaemonLedd()
ret = daemon_ledd.run()
> assert ret == 2
E assert -1 == 2
E +-1
E -2
tests/test_ledd.py:88: AssertionError
Check failure on line 1 in test_run_bad_fvp
azure-pipelines / Azure.sonic-platform-daemons
test_run_bad_fvp
assert 0 == 4 +0 -4
Raw output
self = <tests.test_ledd.TestDaemonLedd object at 0x7fec14e77550>
mock_select = <MagicMock name='Select' id='140651939722384'>
mock_sst = <MagicMock name='SubscriberStateTable' id='140651939734576'>
mock_cstrso = <MagicMock name='CastSelectableToRedisSelectObj' id='140651939750720'>
mock_load_plat_util = <MagicMock name='load_platform_util' id='140651939742288'>
@mock.patch("ledd.DaemonLedd.load_platform_util")
@mock.patch("ledd.swsscommon.CastSelectableToRedisSelectObj")
@mock.patch("ledd.swsscommon.SubscriberStateTable")
@mock.patch("ledd.swsscommon.Select")
def test_run_bad_fvp(self, mock_select, mock_sst, mock_cstrso, mock_load_plat_util):
select_instance = mock_select.return_value
select_instance.select.return_value = (ledd.swsscommon.Select.OBJECT, mock.MagicMock())
mock_cstrso.return_value.getDbConnector.return_value.getNamespace.return_value = ledd.multi_asic.DEFAULT_NAMESPACE
sst_instance = mock_sst.return_value
for fvp in [None, {}]:
sst_instance.pop.return_value = ('Ethernet0', 'SET', fvp)
daemon_ledd = ledd.DaemonLedd()
ret = daemon_ledd.run()
> assert ret == 4
E assert 0 == 4
E +0
E -4
tests/test_ledd.py:126: AssertionError
Check failure on line 1 in test_run_ignore_keys
azure-pipelines / Azure.sonic-platform-daemons
test_run_ignore_keys
assert 0 == 3 +0 -3
Raw output
self = <tests.test_ledd.TestDaemonLedd object at 0x7fec14e42a60>
mock_select = <MagicMock name='Select' id='140651939505776'>
mock_sst = <MagicMock name='SubscriberStateTable' id='140651940001152'>
mock_cstrso = <MagicMock name='CastSelectableToRedisSelectObj' id='140651940011984'>
mock_load_plat_util = <MagicMock name='load_platform_util' id='140651939610432'>
@mock.patch("ledd.DaemonLedd.load_platform_util")
@mock.patch("ledd.swsscommon.CastSelectableToRedisSelectObj")
@mock.patch("ledd.swsscommon.SubscriberStateTable")
@mock.patch("ledd.swsscommon.Select")
def test_run_ignore_keys(self, mock_select, mock_sst, mock_cstrso, mock_load_plat_util):
select_instance = mock_select.return_value
select_instance.select.return_value = (ledd.swsscommon.Select.OBJECT, mock.MagicMock())
mock_cstrso.return_value.getDbConnector.return_value.getNamespace.return_value = ledd.multi_asic.DEFAULT_NAMESPACE
sst_instance = mock_sst.return_value
for key in ['PortConfigDone', 'PortInitDone']:
sst_instance.pop.return_value = ('PortConfigDone', 'SET', {'not': 'applicable'})
daemon_ledd = ledd.DaemonLedd()
ret = daemon_ledd.run()
> assert ret == 3
E assert 0 == 3
E +0
E -3
tests/test_ledd.py:107: AssertionError