-
Notifications
You must be signed in to change notification settings - Fork 190
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
fix(sdk): wing test fails if unable to clean up files #6320
Conversation
Thanks for opening this pull request! 🎉
|
Console preview environment is available at https://wing-console-pr-6320.fly.dev 🚀 Last Updated (UTC) 2024-04-25 13:35 |
BenchmarksComparison to Baseline ⬜⬜⬜⬜🟥⬜⬜⬜⬜⬜⬜⬜⬜
⬜ Within 1.5 standard deviations Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI. Results
Last Updated (UTC) 2024-04-25 13:40 |
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Signed-off-by: monada-bot[bot] <monabot@monada.co>
@MarkMcCulloh @eladb I wasn't sure what the best way to handle this was to be honest (docker and unix permissions inexperience). My first thought was "if my local Wing tests pass, but the test runner couldn't clean everything up, maybe we should just make it a warning" - that was the easiest solution to implement, so I did that here. But there are some other options, I just wasn't sure which would be worth the investment at the moment:
(These are all just ideas, I'm not sure which would work in practice) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of using named volumes. It's a nice separation of something stateful and as a resource it would conveniently have its own lifecycle.
Not exactly sure how the APIs will look but it's the only solution that comes to mind that isn't hacky.
Side note: Volumes even seem like a worthy abstraction for the cloud
namespace
Co-authored-by: Elad Ben-Israel <eladb@monada.co>
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Thanks for contributing, @Chriscbr! This PR will now be added to the merge queue, or immediately merged if |
Congrats! 🚀 This was released in Wing 0.72.8. |
Another pass at solving #6284 The approach taken in #6295 where we allow users to bind to the state directory is problematic because docker sometimes changes the permissions of directories on the user's file system after mounting them. This was causing `wing test` to fail (fixed in #6320) and `wing pack` to fail as well. This PR reworks the API so that data can be persisted via named volumes. Specifically, an anonymous docker volume can be specified, and Wing will automatically name it and reuse it across Wing Console runs. The change should fix the previous issues since named volumes are managed by docker. The main downside of this approach is that deleting your `target` directory or the state files in `.state/` will not clean everything up all resources/files created by Wing from your machine, as Docker volumes may still exist. Eventually we can provide some facilities for automatically cleaning these, but we're leaving it intentionally out of scope until this general approach has been validated. ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [ ] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
If a container mounts a volume to the state directory as described in #6295, it can sometimes result in permission errors when the CLI is cleaning up files after
wing test
because the mounted directory may have different permissions.This error only seems to happen on CI for me. I'm not sure of the cause but I'm guessing that in CI, docker runs in a different (rootless maybe?) mode than on macOS.
Unblocks winglang/winglibs#207
Checklist
pr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.