-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vdk-core: add config option for logging execution result
Why? User reasearch indicates that the execution result is too verbose for local runs. Users don't expect a lot of output for successful jobs and expect error output for failing jobs. What? Introduce the LOG_EXECUTION_RESULT config option that enables/disables displaying the end result. How was this tested? Ran locally with successful and failing jobs Functional tests What kind of change is this? Feature/non-breaking Signed-off-by: Dilyan Marinov <mdilyan@vmware.com>
- Loading branch information
1 parent
acf1ef7
commit a1f4872
Showing
8 changed files
with
140 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
projects/vdk-core/tests/functional/run/test_run_log_execution_result.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Copyright 2021-2023 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import os | ||
import unittest.mock | ||
|
||
from click.testing import Result | ||
from functional.run import util | ||
from vdk.plugin.test_utils.util_funcs import cli_assert_equal | ||
from vdk.plugin.test_utils.util_funcs import CliEntryBasedTestRunner | ||
|
||
|
||
def test_run_log_execution_result_enabled(): | ||
with unittest.mock.patch.dict( | ||
os.environ, | ||
{ | ||
"VDK_LOG_EXECUTION_RESULT": "True", | ||
}, | ||
): | ||
runner = CliEntryBasedTestRunner() | ||
|
||
result: Result = runner.invoke(["run", util.job_path("simple-job")]) | ||
|
||
cli_assert_equal(0, result) | ||
assert "Data Job execution summary" in result.output | ||
assert "steps_list" in result.output | ||
|
||
|
||
def test_run_log_execution_result_enabled_on_fail(): | ||
with unittest.mock.patch.dict( | ||
os.environ, | ||
{ | ||
"VDK_LOG_EXECUTION_RESULT": "True", | ||
}, | ||
): | ||
runner = CliEntryBasedTestRunner() | ||
|
||
result: Result = runner.invoke(["run", util.job_path("fail-job")]) | ||
|
||
cli_assert_equal(1, result) | ||
assert "Data Job execution summary" in result.output | ||
assert "steps_list" in result.output | ||
|
||
|
||
def test_run_log_execution_result_disabled(): | ||
runner = CliEntryBasedTestRunner() | ||
|
||
result: Result = runner.invoke(["run", util.job_path("simple-job")]) | ||
|
||
cli_assert_equal(0, result) | ||
assert "Data Job execution summary" not in result.output | ||
assert "steps_list" not in result.output | ||
assert "Job execution result: SUCCESS" in result.output | ||
|
||
|
||
def test_run_log_execution_result_disabled_on_fail(): | ||
runner = CliEntryBasedTestRunner() | ||
|
||
result: Result = runner.invoke(["run", util.job_path("fail-job")]) | ||
|
||
cli_assert_equal(1, result) | ||
assert "Data Job execution summary" not in result.output | ||
assert "steps_list" not in result.output | ||
assert "Job execution result: FAILED" in result.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters