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 a testcase for GNOI OS.Verify. #16770

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

hdwhdw
Copy link
Contributor

@hdwhdw hdwhdw commented Feb 4, 2025

Description of PR

Summary:
Add a testcase for GNOI OS.Verify.

Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • [x ] New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405
  • 202411

Approach

What is the motivation for this PR?

Add a testcase for GNOI OS.Verify.

How did you do it?

Add a testcase for GNOI OS.Verify.

How did you verify/test it?

On physical switch:
with an up to date image

============================== warnings summary ===============================
../../../usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236
  /usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
    "class": algorithms.Blowfish,

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
-- generated xml file: /data/sonic-mgmt-int/tests/logs/gnmi/test_gnoi_os.xml --
================== 1 passed, 1 warning in 631.44s (0:10:31) ===================

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@hdwhdw hdwhdw marked this pull request as ready for review February 4, 2025 03:34
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

match = json_pattern.search(output)
if match:
try:
return json.loads(match.group())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fragile to use regex to extract a piece of json string. How about just skip first line and parse 2nd line as json string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that less tolerant to different outputs? Say someone would print:

System Time: {response json}

Or simply

{response json}

then the method won't work. The original method works as long as the first json substring is the response json, doesn't matter what you print before it (as long as it doesn't somehow contain another json).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants