-
Notifications
You must be signed in to change notification settings - Fork 549
Hide stack trace shown on YAML parse error by default #1253
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| Hide the stack trace on a YAML parse error. |
This file contains hidden or 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 hidden or 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,4 @@ | ||
| version: "3" | ||
| services:foo | ||
| web1: | ||
| image: busybox |
This file contains hidden or 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,4 @@ | ||
| version: "3" | ||
| services: | ||
| web1: | ||
| image: busybox |
66 changes: 66 additions & 0 deletions
66
tests/integration/parse-error/test_podman_compose_parse_error.py
This file contains hidden or 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,66 @@ | ||
| # SPDX-License-Identifier: GPL-2.0 | ||
|
|
||
| import os | ||
| import unittest | ||
|
|
||
| from tests.integration.test_utils import RunSubprocessMixin | ||
| from tests.integration.test_utils import podman_compose_path | ||
| from tests.integration.test_utils import test_path | ||
|
|
||
|
|
||
| def bad_compose_yaml_path() -> str: | ||
| base_path = os.path.join(test_path(), "parse-error") | ||
| return os.path.join(base_path, "docker-compose-error.yml") | ||
|
|
||
|
|
||
| def good_compose_yaml_path() -> str: | ||
| base_path = os.path.join(test_path(), "parse-error") | ||
| return os.path.join(base_path, "docker-compose.yml") | ||
|
|
||
|
|
||
| class TestComposeBuildParseError(unittest.TestCase, RunSubprocessMixin): | ||
| def test_no_error(self) -> None: | ||
| try: | ||
| _, err = self.run_subprocess_assert_returncode( | ||
| [podman_compose_path(), "-f", good_compose_yaml_path(), "config"], 0 | ||
| ) | ||
| self.assertEqual(b"", err) | ||
|
|
||
| finally: | ||
| self.run_subprocess([ | ||
| podman_compose_path(), | ||
| "-f", | ||
| bad_compose_yaml_path(), | ||
| "down", | ||
| ]) | ||
|
|
||
| def test_simple_parse_error(self) -> None: | ||
| try: | ||
| _, err = self.run_subprocess_assert_returncode( | ||
| [podman_compose_path(), "-f", bad_compose_yaml_path(), "config"], 1 | ||
| ) | ||
| self.assertIn(b"could not find expected ':'", err) | ||
| self.assertNotIn(b"\nTraceback (most recent call last):\n", err) | ||
|
|
||
| finally: | ||
| self.run_subprocess([ | ||
| podman_compose_path(), | ||
| "-f", | ||
| bad_compose_yaml_path(), | ||
| "down", | ||
| ]) | ||
|
|
||
| def test_verbose_parse_error_contains_stack_trace(self) -> None: | ||
| try: | ||
| _, err = self.run_subprocess_assert_returncode( | ||
| [podman_compose_path(), "--verbose", "-f", bad_compose_yaml_path(), "config"], 1 | ||
| ) | ||
| self.assertIn(b"\nTraceback (most recent call last):\n", err) | ||
|
|
||
| finally: | ||
| self.run_subprocess([ | ||
| podman_compose_path(), | ||
| "-f", | ||
| bad_compose_yaml_path(), | ||
| "down", | ||
| ]) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.