Skip to content

Commit dcf37a3

Browse files
committed
resolved function error
1 parent 0dc74c8 commit dcf37a3

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

tests/hostcfgd/hostcfgd_test.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -295,30 +295,30 @@ def test_dns_events(self):
295295
mocked_run_cmd.assert_has_calls([call(['systemctl', 'restart', 'resolv-config'], True, False)])
296296

297297
def test_memory_statistics_event(self):
298-
MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB)
299-
daemon = hostcfgd.HostConfigDaemon()
300-
daemon.register_callbacks()
301-
MockConfigDb.event_queue = [('MEMORY_STATISTICS', 'config')]
302-
303-
with mock.patch('hostcfgd.subprocess') as mocked_subprocess:
304-
popen_mock = mock.Mock()
305-
attrs = {'communicate.return_value': ('output', 'error')}
306-
popen_mock.configure_mock(**attrs)
307-
mocked_subprocess.Popen.return_value = popen_mock
308-
mocked_subprocess.check_call = mock.Mock()
309-
310-
try:
311-
daemon.start()
312-
except TimeoutError:
313-
pass
314-
315-
expected = [
316-
mock.call(['sonic-memory_statistics-config', '--enable']),
317-
mock.call(['sonic-memory_statistics-config', '--retention_time', '15']),
318-
mock.call(['sonic-memory_statistics-config', '--sampling_interval', '5'])
319-
]
298+
MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB)
299+
daemon = hostcfgd.HostConfigDaemon()
300+
daemon.register_callbacks()
301+
MockConfigDb.event_queue = [('MEMORY_STATISTICS', 'config')]
320302

321-
mocked_subprocess.check_call.assert_has_calls(expected, any_order=True)
303+
with mock.patch('hostcfgd.subprocess') as mocked_subprocess:
304+
popen_mock = mock.Mock()
305+
attrs = {'communicate.return_value': ('output', 'error')}
306+
popen_mock.configure_mock(**attrs)
307+
mocked_subprocess.Popen.return_value = popen_mock
308+
mocked_subprocess.check_call = mock.Mock()
309+
310+
try:
311+
daemon.start()
312+
except TimeoutError:
313+
pass
314+
315+
expected = [
316+
mock.call(['sonic-memory_statistics-config', '--enable']),
317+
mock.call(['sonic-memory_statistics-config', '--retention_time', '15']),
318+
mock.call(['sonic-memory_statistics-config', '--sampling_interval', '5'])
319+
]
320+
321+
mocked_subprocess.check_call.assert_has_calls(expected, any_order=True)
322322

323323

324324
class TestDnsHandler:

0 commit comments

Comments
 (0)