Skip to content

Commit

Permalink
Force save logs before making disk read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
renukamanavalan committed Oct 6, 2021
1 parent a318813 commit cba4710
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/tacacs/test_ro_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import time
from pkg_resources import parse_version

from tests.common.plugins.loganalyzer.loganalyzer import LogAnalyzer
from tests.common.utilities import wait_until
from tests.common.utilities import skip_release
from tests.common.utilities import wait
from .test_ro_user import ssh_remote_run

pytestmark = [
pytest.mark.disable_loganalyzer,
pytest.mark.topology('any')
]

Expand Down Expand Up @@ -96,6 +94,16 @@ def test_ro_disk(localhost, duthosts, enum_rand_one_per_hwsku_hostname, creds_al

assert ret, "Failed to ssh as rw user"

# Force a log rotate to get logs so far recorded.
# The read-only state and follow up reboot could wipe off current logs
#
logging.info("test_ro_disk: Flushing & log rotating to save logs so far")
duthost.shell("logger -p local0.notice 'test_ro_disk: Initiating log rotate'")
duthost.shell("pkill -HUP rsyslogd") # To flush logs from daemon to file
time.sleep(30) # Give a pause before rotate
duthost.shell("/usr/sbin/logrotate -f /etc/logrotate.conf > /dev/null 2>&1")
time.sleep(30) # Pause before making disk RO

# Set disk in RO state
simulate_ro(duthost)

Expand Down

0 comments on commit cba4710

Please sign in to comment.