Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion generic_config_updater/gu_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ def validate_config_db_config(self, config_db_as_json):
try:
tmp_config_db_as_json = copy.deepcopy(config_db_as_json)

sy.loadData(tmp_config_db_as_json)
# Loading data automatically does full validation.
# quiet=True suppresses sonic_yang.loadData's LOG_ERR
# "Data Loading Failed" line on every exception (log-and-throw
# antipattern). Real failures still surface via the returned
# tuple / SonicYangException, so callers retain full error
# signal -- only the duplicate syslog spam is silenced.
sy.loadData(tmp_config_db_as_json, quiet=True)

sy.validate_data_tree()

Expand Down
17 changes: 17 additions & 0 deletions tests/generic_config_updater/patch_sorter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,23 @@ def test_validate__valid_config_db_after_applying_move__success(self):
# Act and assert
self.assertTrue(validator.validate(self.any_move, self.any_diff))

def test_validate__passes_quiet_true_to_config_wrapper(self):
# Regression guard: gu_common.ConfigWrapper.validate_config_db_config
# MUST call sonic_yang.loadData with quiet=True so the speculative
# patch-sort search does not spam syslog with transient YANG
# leafref LOG_ERR lines (the sorter already handles those via the
# returned tuple). This is enforced inside ConfigWrapper itself,
# so all callers benefit; FullConfigMoveValidator simply delegates.
config_wrapper = Mock()
config_wrapper.validate_config_db_config.return_value = (True, None)
validator = ps.FullConfigMoveValidator(config_wrapper)

validator.validate(self.any_move, self.any_diff)

config_wrapper.validate_config_db_config.assert_called_once_with(
self.any_simulated_config)


class TestCreateOnlyMoveValidator(unittest.TestCase):
def setUp(self):
self.validator = ps.CreateOnlyMoveValidator(ps.PathAddressing())
Expand Down
Loading