Skip to content

Commit

Permalink
iDebugging
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshraghupathy committed Nov 13, 2024
1 parent d9b925a commit cf35689
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sonic-chassisd/tests/test_chassisd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import mock
import tempfile
from imp import load_source
from datetime import datetime
# from datetime import datetime

from mock import Mock, MagicMock, patch, mock_open
from sonic_py_common import daemon_base
Expand Down Expand Up @@ -510,13 +510,13 @@ def test_smartswitch_module_db_update():

module_updater = SmartSwitchModuleUpdater(SYSLOG_IDENTIFIER, chassis)

expected_path = "/host/reboot-cause/module/reboot_cause|dpu0|2024_11_12_02_03_08/history/2024_11_13_15_06_40_reboot_cause.txt"
expected_path = "/host/reboot-cause/module/reboot_cause/dpu0/history/2024_11_13_15_06_40_reboot_cause.txt"

with patch("os.path.exists", return_value=True), \
patch("os.makedirs") as mock_makedirs, \
patch("builtins.open", ss_mock_open(expected_path, read_data="Power loss")), \
patch("datetime") as mock_datetime:
mock_datetime.now.return_value = datetime(2024, 11, 12, 15, 6, 40)
patch("builtins.open", ss_mock_open(expected_path, read_data="Power loss")):
# patch("datetime") as mock_datetime:
# mock_datetime.now.return_value = datetime(2024, 11, 12, 15, 6, 40)

# Call the function to test
module_updater.persist_dpu_reboot_cause(reboot_cause, key)
Expand Down

0 comments on commit cf35689

Please sign in to comment.