Skip to content
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

Add test coverage for update-checkout --stash option #72523

Open
MaxDesiatov opened this issue Mar 22, 2024 · 3 comments · May be fixed by #72823
Open

Add test coverage for update-checkout --stash option #72523

MaxDesiatov opened this issue Mar 22, 2024 · 3 comments · May be fixed by #72823
Assignees
Labels
contributor experience good first issue Good for newcomers task test suite Area: test suite update-checkout Area → utils: the `update-checkout` script utils Area: the build system and other accessory scripts under the "utils" directory

Comments

@MaxDesiatov
Copy link
Member

update-checkout has a Python unit test suite at utils/update_checkout/tests. You can run it using utils/update_checkout/run_tests.py or lit + validation-test/Python/update_checkout.swift. The test suite is centered around an intermediary unittest.TestCase subclass from which all the effective test classes inherit. This base class is responsible for setting up and tearing down a mock-up environment consisting of a directory of local remotes and a source root — a directory for their clones. Subclasses define test functions that run update-checkout commands against these mock repositories and perform state checks.

I think a single test function that

  1. clones the remotes using update-checkout
  2. creates some untracked files in several clones
  3. runs update-checkout with --stash
  4. verifies that the untracked files have indeed been stashed and nothing else happened

would good enough for now (the update/clone tests, if any, are really basic anyway). I would place this function in a new subclass in its own file.

Originally posted by @AnthonyLatsis in #71178 (comment)

@MaxDesiatov MaxDesiatov added test suite Area: test suite update-checkout Area → utils: the `update-checkout` script good first issue Good for newcomers contributor experience labels Mar 22, 2024
@fabricerenard12
Copy link

Hi MaxDesiatov, I am new to the open-source contribution. If no one is currently working on this issue, I would like to work on it. If that is the case, could you assign it to me? Thanks a lot!

@AnthonyLatsis AnthonyLatsis added the utils Area: the build system and other accessory scripts under the "utils" directory label Mar 23, 2024
@MaxDesiatov
Copy link
Member Author

  1. clones the remotes using update-checkout

My concern here is that this is quite a long-running operation for real repositories. Maybe creating some mock repositories on the file system in a temp directory could be a sufficient workaround for that.

@AnthonyLatsis
Copy link
Collaborator

  1. clones the remotes using update-checkout

Using the mock remotes that are already set up for each test, of course. See test_clone.py.

fabricerenard12 added a commit to fabricerenard12/swift that referenced this issue Apr 3, 2024
fabricerenard12 added a commit to fabricerenard12/swift that referenced this issue Apr 3, 2024
author Fabrice Renard <[email protected]> 1711509329 -0400
committer Fabrice Renard <[email protected]> 1712183881 -0400

parent dea09e1
author Fabrice Renard <[email protected]> 1711509329 -0400
committer Fabrice Renard <[email protected]> 1712183868 -0400

Complete update-checkout stash test

apple#72523
fabricerenard12 added a commit to fabricerenard12/swift that referenced this issue Apr 3, 2024
fabricerenard12 added a commit to fabricerenard12/swift that referenced this issue Apr 3, 2024
@fabricerenard12 fabricerenard12 linked a pull request Apr 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor experience good first issue Good for newcomers task test suite Area: test suite update-checkout Area → utils: the `update-checkout` script utils Area: the build system and other accessory scripts under the "utils" directory
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants