Skip to content

Commit

Permalink
Only collect stdout of orchagent_restart_check in vstest (#2578)
Browse files Browse the repository at this point in the history
*[vstest] Only collect stdout of orchagent_restart_check in vstest
  • Loading branch information
bingwang-ms authored Dec 19, 2022
1 parent def98d9 commit c00455a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def restart(self) -> None:
self.ctn_restart()
self.check_ready_status_and_init_db()

def runcmd(self, cmd: str) -> Tuple[int, str]:
def runcmd(self, cmd: str, include_stderr=True) -> Tuple[int, str]:
res = self.ctn.exec_run(cmd)
exitcode = res.exit_code
out = res.output.decode("utf-8")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_FdbWarmRestartNotifications(self, dvs, testlog):
dvs.warm_restart_swss("true")

# freeze orchagent for warm restart
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check")
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check", include_stderr=False)
assert result == "RESTARTCHECK succeeded\n"
time.sleep(2)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_port_an.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_PortAutoNegWarm(self, dvs, testlog):
dvs.warm_restart_swss("true")

# freeze orchagent for warm restart
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check")
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check", include_stderr=False)
assert result == "RESTARTCHECK succeeded\n"
time.sleep(2)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_port_lt.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_PortLinkTrainingWarm(self, dvs, testlog):
assert exitcode == 0

# freeze orchagent for warm restart
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check")
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check", include_stderr=False)
assert result == "RESTARTCHECK succeeded\n"
time.sleep(2)

Expand Down
8 changes: 4 additions & 4 deletions tests/test_warm_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,23 +891,23 @@ def test_OrchagentWarmRestartReadyCheck(self, dvs, testlog):

time.sleep(1)
# Should fail, since neighbor for next 20.0.0.1 has not been not resolved yet
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check")
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check", include_stderr=False)
assert result == "RESTARTCHECK failed\n"

# Should succeed, the option for skipPendingTaskCheck -s and noFreeze -n have been provided.
# Wait up to 500 milliseconds for response from orchagent. Default wait time is 1000 milliseconds.
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check -n -s -w 500")
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check -n -s -w 500", include_stderr=False)
assert result == "RESTARTCHECK succeeded\n"

# Remove unfinished routes
ps._del("3.3.3.0/24")

time.sleep(1)
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check")
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check", include_stderr=False)
assert result == "RESTARTCHECK succeeded\n"

# Should fail since orchagent has been frozen at last step.
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check -n -s -w 500")
(exitcode, result) = dvs.runcmd("/usr/bin/orchagent_restart_check -n -s -w 500", include_stderr=False)
assert result == "RESTARTCHECK failed\n"

# Cleaning previously pushed route-entry to ease life of subsequent testcases.
Expand Down

0 comments on commit c00455a

Please sign in to comment.