Skip to content

[Tests] Fix copying files for test cluster #124628

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 7 commits into from
Mar 12, 2025
Merged

[Tests] Fix copying files for test cluster #124628

merged 7 commits into from
Mar 12, 2025

Conversation

jozala
Copy link
Contributor

@jozala jozala commented Mar 12, 2025

In case when file with .attach_pid in name was stored in distribution and then deleted, the exception could stop copying/linking files without any sign of issue. The files were then missing in the cluster used in the tests causing failures (sometimes - depending on which files haven't been copied).

jozala added 6 commits March 11, 2025 10:01
In case when file with `.attach_pid` in name was stored in distribution
and then deleted, the exception could stop copying/linking files
without any sign of issue. The files were then missing in the cluster
used in the test causing them sometimes to fail (depending on which
files haven't been copied).
When using `Files.walk` it is impossible to catch the IOException and
continue walking through files conditionally. It has been replaced with
FileVisitor implementation to be able to continue if the exception is
caused by files left temporarily by JVM but no longer available.
Also simplify exception handling
@jozala jozala added >non-issue >test Issues or PRs that are addressing/adding tests :Delivery/Build Build or test infrastructure auto-backport Automatically create backport pull requests when merged v8.18.1 v8.19.0 v9.0.1 v9.1.0 v7.17.29 v8.16.6 v8.17.4 labels Mar 12, 2025
@jozala jozala requested a review from a team as a code owner March 12, 2025 08:55
@elasticsearchmachine elasticsearchmachine added the Team:Delivery Meta label for Delivery team label Mar 12, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

Copy link
Contributor

@breskeby breskeby left a comment

Choose a reason for hiding this comment

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

I think theres some duplication we could avoid by maybe making the sync method in IOUtils a bit smarter and get rid of ElasticsearchNode#sync here

@@ -1295,40 +1298,47 @@ private void syncWithCopy(Path sourceRoot, Path destinationRoot) {

private void sync(Path sourceRoot, Path destinationRoot, BiConsumer<Path, Path> syncMethod) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we reuse IOUtils#sync here? Maybe with tweaking the IOUtils#sync method but that looks mostly duplication we could simplify and avoid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding was that this duplication is on purpose, to keep the old and new test cluster frameworks separate.
ElasticsearchNode is from the deprecated framework and IOUtils is from the new JUnit rule-based framework.
I believe we do not want the dependency between those two sub-projects, right?

One way to solve this is to move the IOUtils to a different subproject and depend on it from both frameworks sub-projects.
The old framework will probably not go away soon, but when it will, then it would make sense to leave the IOUtils in the :test:test-cluster. Because of that I am leaning towards accepting the duplication.
What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah I see now. I missed we use IOUtils in our new framework only. yeah lets keep it then 👍

@jozala jozala merged commit 4ff1aad into main Mar 12, 2025
17 of 18 checks passed
@jozala jozala deleted the test-cluster-setup-fix branch March 12, 2025 15:09
jozala added a commit to jozala/elasticsearch that referenced this pull request Mar 12, 2025
In case when file with `.attach_pid` in name was stored in distribution
and then deleted, the exception could stop copying/linking files
without any sign of issue. The files were then missing in the cluster
used in the test causing them sometimes to fail (depending on which
files haven't been copied).

When using `Files.walk` it is impossible to catch the IOException and
continue walking through files conditionally. It has been replaced with
FileVisitor implementation to be able to continue if the exception is
caused by files left temporarily by JVM but no longer available.
This was referenced Mar 13, 2025
jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request Mar 13, 2025
In case when file with `.attach_pid` in name was stored in distribution
and then deleted, the exception could stop copying/linking files
without any sign of issue. The files were then missing in the cluster
used in the test causing them sometimes to fail (depending on which
files haven't been copied).

When using `Files.walk` it is impossible to catch the IOException and
continue walking through files conditionally. It has been replaced with
FileVisitor implementation to be able to continue if the exception is
caused by files left temporarily by JVM but no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged backport pending :Delivery/Build Build or test infrastructure >non-issue Team:Delivery Meta label for Delivery team >test Issues or PRs that are addressing/adding tests v7.17.29 v8.16.6 v8.17.4 v8.18.1 v8.19.0 v9.0.1 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants