-
Notifications
You must be signed in to change notification settings - Fork 70
chore: remove generated files in tests #2644
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
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6b4c482
chore: remove generated files in IT
JoeWang1127 2236ec6
remove output folder
JoeWang1127 b001648
remove image
JoeWang1127 35c143e
change ignore
JoeWang1127 e446c9b
remove generated files in unit tests
JoeWang1127 afec325
ignore output
JoeWang1127 309232f
Merge branch 'main' into chore/update-integration-test
JoeWang1127 65c77c0
Merge branch 'chore/update-integration-test' of github.com:googleapis…
JoeWang1127 df6e53f
comment out remove
JoeWang1127 9a57edc
Merge branch 'main' into chore/update-integration-test
JoeWang1127 fa588e4
remove generated pom
JoeWang1127 9dab038
lint python
JoeWang1127 2cd421e
remove dir if exists
JoeWang1127 6266037
Merge branch 'main' into chore/update-integration-test
JoeWang1127 d4afa4d
change method name
JoeWang1127 9ddc371
Merge branch 'main' into chore/update-integration-test
JoeWang1127 d4079e2
remove files after succeeds
JoeWang1127 314cee2
Merge branch 'main' into chore/update-integration-test
JoeWang1127 819e756
change intention
JoeWang1127 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
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
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 |
|---|---|---|
|
|
@@ -51,9 +51,16 @@ class IntegrationTest(unittest.TestCase): | |
| def setUpClass(cls) -> None: | ||
| IntegrationTest.__build_image(docker_file=build_file, cwd=repo_root_dir) | ||
|
|
||
| def test_entry_point_running_in_container(self): | ||
| shutil.rmtree(f"{golden_dir}", ignore_errors=True) | ||
| @classmethod | ||
| def tearDownClass(cls) -> None: | ||
| cls.__remove_docker_image() | ||
|
|
||
| @classmethod | ||
| def setUp(cls) -> None: | ||
| cls.__remove_generated_files() | ||
| os.makedirs(f"{golden_dir}", exist_ok=True) | ||
|
|
||
| def test_entry_point_running_in_container(self): | ||
| config_files = self.__get_config_files(config_dir) | ||
| for repo, config_file in config_files: | ||
| config = from_yaml(config_file) | ||
|
|
@@ -168,6 +175,7 @@ def test_entry_point_running_in_container(self): | |
| "The generated PR description does not match the expected golden file", | ||
| ) | ||
| print(" PR description comparison succeed.") | ||
| self.__remove_generated_files() | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the generated files after the integration test succeeds. |
||
|
|
||
| @classmethod | ||
| def __build_image(cls, docker_file: str, cwd: str): | ||
|
|
@@ -176,6 +184,13 @@ def __build_image(cls, docker_file: str, cwd: str): | |
| cwd=cwd, | ||
| ) | ||
|
|
||
| @classmethod | ||
| def __remove_generated_files(cls): | ||
| # uncomment this line when the generated files don't owned by root. | ||
| # shutil.rmtree(f"{output_dir}", ignore_errors=True) | ||
| if os.path.isdir(f"{golden_dir}"): | ||
| shutil.rmtree(f"{golden_dir}") | ||
|
|
||
| @classmethod | ||
| def __pull_repo_to(cls, dest: Path, repo: str, committish: str) -> str: | ||
| shutil.rmtree(dest, ignore_errors=True) | ||
|
|
@@ -323,3 +338,7 @@ def __recursive_diff_files( | |
| cls.__recursive_diff_files( | ||
| sub_dcmp, diff_files, left_only, right_only, dirname + sub_dirname + "/" | ||
| ) | ||
|
|
||
| @classmethod | ||
| def __remove_docker_image(cls): | ||
| subprocess.check_call(["docker", "image", "rmi", image_tag]) | ||
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
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.