-
Notifications
You must be signed in to change notification settings - Fork 661
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
Run yang validation in unit test #3025
Conversation
@@ -3,17 +3,17 @@ | |||
"VERSION": "version_4_0_3" | |||
}, | |||
"FLEX_COUNTER_TABLE|ACL": { | |||
"FLEX_COUNTER_STATUS": "true", | |||
"FLEX_COUNTER_STATUS": "enable", |
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.
I will check with owner.
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.
@vadymhlushko-mlnx has confirmed this is a mistake.
scripts/db_migrator.py
Outdated
@@ -1122,6 +1124,27 @@ def migrate(self): | |||
version = next_version | |||
# Perform common migration ops | |||
self.common_migration_ops() | |||
if os.environ["UTILITIES_UNIT_TESTING"] == "2": |
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.
I am thinking this detection is useful in production runtime as background task, not just unit test. It will help detect bugs like:
- db_migrator generates a new config but not yang validated
- load_minigraph generates a new config but not yang validated
Not sure if there are other places the yang validation could help in runtime. But let's only detect and generate CRIT syslog, not to block the existing workflow.
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.
Updated
/azpw run |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azpw run |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
I saw this PR is pending on https://github.com/sonic-net/sonic-buildimage/pull/16974/files. |
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.
LGTM
What I did
Add unit test for db_migrator.py: ConfigDB passing yang validation.
Microsoft ADO: 24657445
Pending on sonic-net/sonic-buildimage#16974
How I did it
Add yang validation for unit test, and fix test data to pass yang validation.
How to verify it
Run sonic-utilities end to end test.
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)