Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fsck check test case. #11232

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/platform_tests/test_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,21 @@ def test_continuous_reboot(duthosts, enum_rand_one_per_hwsku_hostname,
pytest_assert(ls_ending_out == ls_starting_out,
"Console devices have changed: expected console devices: {}, got: {}"
.format(", ".join(sorted(ls_starting_out)), ", ".join(sorted(ls_ending_out))))


def test_fsck_after_reboot(duthosts, enum_rand_one_per_hwsku_hostname,
localhost, conn_graph_facts, xcvr_skip_list): # noqa F811
"""
@summary: This test case is checking syslog to verify fsck script has run for
checking and repairing the file system when boot in initramfs stage.
"""
duthost = duthosts[enum_rand_one_per_hwsku_hostname]

# Call reboot to run fsck for repair file system.
reboot_and_check(localhost, duthost, conn_graph_facts["device_conn"][duthost.hostname],
xcvr_skip_list, reboot_type=REBOOT_TYPE_COLD, duthosts=duthosts)

# Check fsck ran by syslog entry.
cmd = "sudo find /var/log/syslog* -type f -mmin -5 -exec zgrep 'fsck' {} +"
xincunli-sonic marked this conversation as resolved.
Show resolved Hide resolved
result = duthost.shell(cmd, module_ignore_errors=True, verbose=True)['stdout']
pytest_assert("fsck" in result, "The file system should be repaired by fsck script.")
Loading