Fix do_init function in telemetry/conftest.py #16546
Open
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: Fix
do_init
function intelemetry/conftest.py
Fixes #
Test case
telemetry/test_events.py::test_events
failed in fixturetest_eventd_healthy
with error messageFileNotFoundError: [Errno 2] No such file or directory: 'logs/telemetry/files/heartbeat.json'
Issue1: The
os.mkdir()
function can only create one-level directory and cannot automatically create multiple directories. When createlogs/telemetry
, if "logs" directory does not exist, it will raise an error. Useos.makedirs()
function can avoid this issue.Issue2: The error message
Dir/file already exists
in the except section is inaccurate. Failure may also be due to other reasons, and this log might be confusing.Issue3: Just copy
telemetry/validate_yang_events.py
onceAdd pdb output
Type of change
Back port request
Approach
What is the motivation for this PR?
How did you do it?
How did you verify/test it?
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation