Skip to content

Commit

Permalink
fix: Issue 1127 configs dir fails with more than 40 files (#1130)
Browse files Browse the repository at this point in the history
* Updated main to run validation right after building config managers

* Updated test

* Linted and black8

---------

Co-authored-by: Helen Cristina <[email protected]>
  • Loading branch information
sundar-mudupalli-work and helensilva14 committed May 15, 2024
1 parent 72e41b7 commit 15c81cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions data_validation/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ def config_runner(args):
setattr(args, "config_dir", None)
setattr(args, "config_file", config_file_path)
config_managers = build_config_managers_from_yaml(args, config_file_path)
run_validations(args, config_managers)
else:
if args.kube_completions:
logging.warning(
Expand All @@ -364,16 +365,16 @@ def config_runner(args):
config_file_names = cli_tools.list_validations(config_dir=args.config_dir)
config_managers = []
for file in config_file_names:
config_managers.extend(build_config_managers_from_yaml(args, file))
config_managers = build_config_managers_from_yaml(args, file)
run_validations(args, config_managers)
else:
if args.kube_completions:
logging.warning(
"--kube-completions or -kc specified, which requires a config directory, however a specific config file is provided."
)
config_file_path = _get_arg_config_file(args)
config_managers = build_config_managers_from_yaml(args, config_file_path)

run_validations(args, config_managers)
run_validations(args, config_managers)


def build_config_managers_from_yaml(args, config_file_path):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test__main.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def test_config_runner_2(mock_args, mock_build, mock_run, caplog):
assert caplog.messages == [
"--kube-completions or -kc specified, however not running in Kubernetes Job completion, check your command line."
]
# assert that 3 config managers are present
assert len(mock_run.call_args.args[1]) == 3
# assert that validation is called thrice, once for each file
assert mock_run.call_count == 3


@mock.patch("data_validation.__main__.run_validations")
Expand Down

0 comments on commit 15c81cf

Please sign in to comment.