-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a function to return a list of files that we want to check and reuse it everywhere?
In case we want to change something in the future, we will need to apply the change only once.
test_lib/xml_format_checker.py
Outdated
else: | ||
logger.debug(fname + ":Invalid input file format") | ||
test_status = False | ||
if contains_XML and contains_log: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this condition will be always logically False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition will be true if we have a mixture of.xml and .log files in the requirement test folder. This is not allowed. It was a check requested to be added to avoid confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nandinivij ,
Take a look at splunk/pytest-splunk-addon#549 please
Regarding this point
I don't want this PR cause need of braking change.
I want ppl to start using .xml first and work on tool that helps to migrate from .log to .xml
The tool is not a mandatory if we want to change file extension only, but there are much more things that needs to be done to PSA samples in the future - like merging knowledge and requirement tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @hsekowski-splunk I am aware of the future scope regarding KO and req test samples, But this PR is to support the .xml or .log files in unit tests. As we already merged the PR to support both in PSA.
Without this PR -
Req test - will support .xml or .log
But unit test will throw an error of invalid file format when it finds a .xml file.
https://github.com/splunk/splunk-add-on-for-juniper/runs/5395821561?check_suite_focus=true
With this PR
Unit tests will also support both .xml /.log format.
Added check here - we restrict the combination of .log and .xml files in the requirement_test/logs folder. The reasoning behind restricting .log and .xml is when the combination is present it can create confusion if one means different from the other.
This is not a breaking change. I am testing this branch with Juniper addon existing logs. Please find test run here - https://github.com/splunk/splunk-add-on-for-juniper/runs/5396003674?check_suite_focus=true
Hope this explains this PR. Let me know if we need to hop on a quick chat
test_lib/xml_format_checker.py
Outdated
else: | ||
logger.debug(fname + ":Invalid input file format") | ||
test_status = False | ||
if contains_XML and contains_log: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nandinivij ,
Take a look at splunk/pytest-splunk-addon#549 please
Regarding this point
I don't want this PR cause need of braking change.
I want ppl to start using .xml first and work on tool that helps to migrate from .log to .xml
The tool is not a mandatory if we want to change file extension only, but there are much more things that needs to be done to PSA samples in the future - like merging knowledge and requirement tests.
🎉 This PR is included in version 1.4.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
check added to xml_format_checker.py to fail the test if we have a mixture of .log and. XML files.
XML format check is the first test. If this fails none of the other tests will run.
All other tests are moved to support both XML and .log files.
Required to support - splunk/pytest-splunk-addon#550 with unit tests
Please review.
tested Github action with juniper addon - https://github.com/splunk/splunk-add-on-for-juniper/pull/277