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 closing resources in quarkus cli as windows is more strict #1378

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

jedla97
Copy link
Member

@jedla97 jedla97 commented Oct 22, 2024

Summary

When running update tes coverage on windows, the resources were not closed and blocking deletion of file and directories. Probably Windows is more strict on this that this was not caught on Linux.

Also even if I dind't see any usage of readYamlFileIntoProperties (actual method which use it is checkYamlPropertiesUpdate but didn't find it in framework or testsuite). I also add try-with-resources for it as it can be problematic in future.

Tested it localy on AWS windows

Please check the relevant options

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Dependency update
  • Refactoring
  • Release (follows conventions described in the RELEASE.md)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • This change requires execution against OCP (use run tests phrase in comment)

Checklist:

  • Example scenarios has been updated / added
  • Methods and classes used in PR scenarios are meaningful
  • Commits are well encapsulated and follow the best practices

@jedla97 jedla97 added triage/backport-1.5? Quarkus 3.15 stream triage/backport-1.4? Quarkus 3.8 stream labels Oct 22, 2024
@jedla97 jedla97 requested a review from mocenas October 22, 2024 14:30
@mocenas
Copy link
Contributor

mocenas commented Oct 22, 2024

Hmm, I would assume that garbage collector would make a quick work of that open files, no matter what OS is it on. But this is probably better.

BTW: Yaml properties are used here - https://github.com/quarkus-qe/quarkus-test-suite/blob/3.8/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/update/Quarkus32to38CliUpdateIT.java#L77 It is not in main TS branch (no actual update test are).

Copy link
Contributor

@mocenas mocenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's just wait for the CI.

@rsvoboda
Copy link
Member

rsvoboda commented Oct 22, 2024

Garbage collector doesn't help with open files. Windows/NTFS has more strict file access and thus the need for try-with-resources or explicit close. Windows forces proper code wrt file system (one can complain it's less nice, but that's Java syntax).

@rsvoboda rsvoboda merged commit a4e5ed0 into quarkus-qe:main Oct 22, 2024
7 checks passed
This was referenced Oct 22, 2024
@jedla97 jedla97 removed the triage/backport-1.5? Quarkus 3.15 stream label Oct 23, 2024
@jedla97 jedla97 mentioned this pull request Oct 23, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/backport-1.4? Quarkus 3.8 stream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants