Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshraghupathy committed Nov 13, 2024
1 parent 8227b4c commit 05ee8d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sonic-chassisd/tests/test_chassisd.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,13 @@ def test_smartswitch_configupdater_check_admin_state():
assert module.get_admin_state() == admin_state


'''
def test_is_first_boot_file_found_first_boot():
chassis = MockSmartSwitchChassis()
module = "DPU0"
def ss_mock_open(*args, **kwargs):
return open(*args, **kwargs)
return mock_open(read_data="First boot")("/mocked/path/to/reboot-cause.txt", **kwargs)
with patch("os.path.join", return_value="/mocked/path/to/reboot-cause.txt"), \
patch("builtins.open", new_callable=ss_mock_open, read_data="First boot") as mock_file:
Expand All @@ -455,7 +456,7 @@ def test_is_first_boot_file_not_found():
module = "DPU0"
def ss_mock_open(*args, **kwargs):
return open(*args, **kwargs)
return mock_open(read_data="First boot")("/mocked/path/to/reboot-cause.txt", **kwargs)
with patch("os.path.join", return_value="/mocked/path/to/reboot-cause.txt"), \
patch("builtins.open", new_callable=ss_mock_open) as mock_file:
Expand All @@ -468,10 +469,13 @@ def ss_mock_open(*args, **kwargs):
# Assert that the result is False because the file was not found
assert not result
'''


def test_smartswitch_module_db_update():
chassis = MockSmartSwitchChassis()
reboot_cause = "Power loss"
key = "REBOOT_CAUSE|DPU0|2024_11_12_02_03_08"
index = 0
name = "DPU0"
desc = "DPU Module 0"
Expand All @@ -488,6 +492,7 @@ def test_smartswitch_module_db_update():

module_updater = SmartSwitchModuleUpdater(SYSLOG_IDENTIFIER, chassis)
module_updater.module_db_update()
module_updater.persist_dpu_reboot_cause(reboot_cause, key)


def test_platform_json_file_exists_and_valid():
Expand Down

0 comments on commit 05ee8d3

Please sign in to comment.