Skip to content

Commit a2cb58b

Browse files
authored
Run yang validation in unit test
<!-- Please make sure you've read and understood our contributing guidelines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md ** Make sure all your commits include a signature generated with `git commit -s` ** If this is a bug fix, make sure your description includes "closes #xxxx", "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related issue when the PR is merged. If you are adding/modifying/removing any command or utility script, please also make sure to add/modify/remove any unit tests from the tests directory as appropriate. If you are modifying or removing an existing 'show', 'config' or 'sonic-clear' subcommand, or you are adding a new subcommand, please make sure you also update the Command Line Reference Guide (doc/Command-Reference.md) to reflect your changes. Please provide the following information: --> #### 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)
1 parent 6a48ea6 commit a2cb58b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/db_migrator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ def migrate(self):
11621162
yang_parser.validate_data_tree()
11631163
except sonic_yang.SonicYangException as e:
11641164
syslog.syslog(syslog.LOG_CRIT, "Yang validation failed: " + str(e))
1165-
if os.environ["UTILITIES_UNIT_TESTING"] == "2":
1165+
if os.environ.get("UTILITIES_UNIT_TESTING", "0") == "2":
11661166
raise
11671167

11681168

0 commit comments

Comments
 (0)