Skip to content

Added detailed reason for assert failure for bgp#19587

Merged
StormLiangMS merged 2 commits intosonic-net:masterfrom
bachalla:assert_bgp
Jul 30, 2025
Merged

Added detailed reason for assert failure for bgp#19587
StormLiangMS merged 2 commits intosonic-net:masterfrom
bachalla:assert_bgp

Conversation

@bachalla
Copy link
Copy Markdown
Contributor

Description of PR

Added detailed Reason for Assert failure

Type of change

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

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.

@bachalla bachalla requested a review from StormLiangMS as a code owner July 14, 2025 13:06
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@bachalla bachalla requested a review from ZhaohuiS July 14, 2025 13:06
@bachalla
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@bachalla
Copy link
Copy Markdown
Contributor Author

image image

"BGP neighbors items: {} "
).format(
(v["state"] for _, v in list(bgp_facts["bgp_neighbors"].items())),
bgp_facts["bgp_neighbors"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove bgp_facts["bgp_neighbors"], which is a long dictionary

"No BGP session with PTF. "
"Speaker IP: {} "
"BGP neighbors: {} "
).format(str(speaker_ips[2].ip), bgp_facts["bgp_neighbors"])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove bgp_facts["bgp_neighbors"], which is a long dictionary

"DUT Host: {}"
"Speaker IPs: {}"
"Neighbor learning status: {}"
).format(duthost, speaker_ips, is_all_neighbors_learned(duthost, speaker_ips))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove is_all_neighbors_learned(duthost, speaker_ips),

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@ZhaohuiS ZhaohuiS left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Copy Markdown
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

LGTM

@StormLiangMS StormLiangMS merged commit 91b6642 into sonic-net:master Jul 30, 2025
15 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jul 31, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #19945

mssonicbld pushed a commit that referenced this pull request Jul 31, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.
nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.

Signed-off-by: Aharon Malkin <amalkin@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.

Signed-off-by: Yael Tzur <ytzur@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Mar 27, 2026
Summary:

Enhanced assertion messages in selected test cases to provide clearer failure context. This improves debuggability and speeds up issue resolution when tests fail.
Added detailed assertion failure messages in test scripts to make it easier to understand why tests fails.

What is the motivation for this PR?
The motivation is to improve test debuggability by adding detailed failure reasons in assertions for selected test cases. This enhancement makes it easier to identify the root cause of test failures in logs, thereby reducing triage time and simplifying test maintenance.

How did you do it?
I updated the assertion statements in the following test files to include descriptive error messages:
tests/bgp/test_bgp_speaker.py
tests/bgp/test_bgp_router_id.py

How did you verify/test it?
Verified that the updated assertion messages are correctly reflected in the test code by reviewing the changes locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants