Skip to content

[action] [PR:22250] check detect time samples before accessing list by index in test_pfcw…#22713

Open
mssonicbld wants to merge 1 commit intosonic-net:202511from
mssonicbld:cherry/202511/22250
Open

[action] [PR:22250] check detect time samples before accessing list by index in test_pfcw…#22713
mssonicbld wants to merge 1 commit intosonic-net:202511from
mssonicbld:cherry/202511/22250

Conversation

@mssonicbld
Copy link
Collaborator

…d_timer_accuracy

Description of PR

Summary:
Fixes # (issue)
36117223

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
  • 202511

Approach

What is the motivation for this PR?

The error message “IndexError: list index out of range” is unclear and potentially misleading.

How did you do it?

Modify the output error message, check the timestamp sample before accessing the list

How did you verify/test it?

run elastic test
202505
https://elastictest.org/scheduler/testplan/69841fb948d58f009f2c7154

202511
https://elastictest.org/scheduler/testplan/69842120bb7d1dad4c803d16

inject failure
https://elastictest.org/scheduler/testplan/698482c1bb7d1dad4c803dc8

> pytest.fail(
 "Too many iterations failed to collect PFCWD timestamps. "
 "Detect time samples: {}/{} (failures: {}), Restore time samples: {}/{} (failures: {}). "
 "Required at least {} samples. This may indicate environment or timing issues.".format(
 detect_count, ITERATION_NUM, detect_failures,
 restore_count, ITERATION_NUM, restore_failures,
 required_samples))
E Failed: Too many iterations failed to collect PFCWD timestamps. Detect time samples: 0/20 (failures: 20), Restore time samples: 0/20 (failures: 20). Required at least 10 samples. This may indicate environment or timing issues.

Any platform specific information?

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

Documentation

…d_timer_accuracy (sonic-net#22250)

What is the motivation for this PR?
The error message “IndexError: list index out of range” is unclear and potentially misleading.

How did you do it?
Modify the output error message, check the timestamp sample before accessing the list

How did you verify/test it?
run elastic test
202505
https://elastictest.org/scheduler/testplan/69841fb948d58f009f2c7154

202511
https://elastictest.org/scheduler/testplan/69842120bb7d1dad4c803d16

inject failure
https://elastictest.org/scheduler/testplan/698482c1bb7d1dad4c803dc8

>           pytest.fail(
                "Too many iterations failed to collect PFCWD timestamps. "
                "Detect time samples: {}/{} (failures: {}), Restore time samples: {}/{} (failures: {}). "
                "Required at least {} samples. This may indicate environment or timing issues.".format(
                    detect_count, ITERATION_NUM, detect_failures,
                    restore_count, ITERATION_NUM, restore_failures,
                    required_samples))
E           Failed: Too many iterations failed to collect PFCWD timestamps. Detect time samples: 0/20 (failures: 20)
Signed-off-by: xuliping <xuliping@microsoft.com>

Signed-off-by: mssonicbld <sonicbld@microsoft.com>
@mssonicbld
Copy link
Collaborator Author

Original PR: #22250

@mssonicbld
Copy link
Collaborator Author

/azp run

@azure-pipelines
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants