[action] [PR:26522] [console] Accept updated picocom termination message#1330
Merged
Merged
Conversation
### Description of PR Summary: Update the reverse-SSH force-interrupt test for the console session behavior introduced by [sonic-utilities PR 4658](sonic-net/sonic-utilities#4658). That change replaced the previous console session implementation and changed the successful termination output from `Picocom was killed` to `Thanks for using picocom`. The console line still returned to `IDLE` and the SSH process exited successfully, but the test failed because it only accepted the legacy message. This PR accepts either termination message so the test remains compatible with images from before and after the sonic-utilities change. It also explicitly initializes the console client variable to satisfy static analysis. Fixes # (issue) ### Type of change - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [x] Test case improvement ### Back port request - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 - [ ] 202511 - [ ] 202512 - [ ] 202605 Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO): N/A Failure type: compatibility with updated console termination output ### Tested branch - [ ] master - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 - [ ] 202511 - [ ] 202512 - [ ] 202605 - [x] N/A ### Test result - Affected SONiC image on a physical `c0` topology: `10 passed` in the full `console/test_console_reversessh.py` module. - Static validation: Python syntax validation passed. ### Approach #### What is the motivation for this PR? The force-interrupt test assumed one specific console termination message. After sonic-utilities PR 4658 changed the console session implementation, successful termination produced a different message and caused a false test failure. #### How did you do it? Use `pexpect.expect_exact()` with the legacy and current termination messages as alternatives. This preserves compatibility across image versions while still validating that the client observes a successful console-session termination message. Explicitly initialize `client` before the session-creation block so static analysis can determine that the local variable is initialized. #### How did you verify/test it? Ran the complete `console/test_console_reversessh.py` module on a physical `c0` topology with the affected SONiC image. All 10 cases passed, including `test_console_reversessh_force_interrupt` and all custom escape-character variants. #### Any platform specific information? None. #### Supported testbed topology if it's a new test case? N/A; this is not a new test case. ### Documentation N/A; test-only compatibility update. Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Collaborator
Author
|
Original PR: sonic-net/sonic-mgmt#26522 |
Collaborator
Author
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
21 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
Summary:
Update the reverse-SSH force-interrupt test for the console session behavior introduced by sonic-utilities PR 4658.
That change replaced the previous console session implementation and changed the successful termination output from
Picocom was killedtoThanks for using picocom. The console line still returned toIDLEand the SSH process exited successfully, but the test failed because it only accepted the legacy message.This PR accepts either termination message so the test remains compatible with images from before and after the sonic-utilities change. It also explicitly initializes the console client variable to satisfy static analysis.
Fixes # (issue)
Type of change
Back port request
Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO): N/A
Failure type: compatibility with updated console termination output
Tested branch
Test result
c0topology:10 passedin the fullconsole/test_console_reversessh.pymodule.Approach
What is the motivation for this PR?
The force-interrupt test assumed one specific console termination message. After sonic-utilities PR 4658 changed the console session implementation, successful termination produced a different message and caused a false test failure.
How did you do it?
Use
pexpect.expect_exact()with the legacy and current termination messages as alternatives. This preserves compatibility across image versions while still validating that the client observes a successful console-session termination message.Explicitly initialize
clientbefore the session-creation block so static analysis can determine that the local variable is initialized.How did you verify/test it?
Ran the complete
console/test_console_reversessh.pymodule on a physicalc0topology with the affected SONiC image. All 10 cases passed, includingtest_console_reversessh_force_interruptand all custom escape-character variants.Any platform specific information?
None.
Supported testbed topology if it's a new test case?
N/A; this is not a new test case.
Documentation
N/A; test-only compatibility update.
Signed-off-by: Sonic Build Admin sonicbld@microsoft.com