[
https://issues.apache.org/jira/browse/CAMEL-20686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17866274#comment-17866274
]
Jang-Vijay Singh commented on CAMEL-20686:
------------------------------------------
Hi [~orpiske] & [~davsclaus] Based on Devlocity observations:
* Relatively few of *org.apache.camel.component.file.** tests are flaky
{_}(see screenshot sorted by FLAKY % desc){_}, so I am prioritising the ones
flagged up there. _The reason a lot of them +don't+ seem to have problems is
that the test-specific files like "hello.txt" are created within JUnit runtime
temp folders that are fairly unique (e.g. \Temp\junit8522201667184135259\)_
* Not all of org.apache.camel.component.file.* tests are in core/camel-core -
Many of these are spread out in other components like *camel-ftp* - the lists I
have attached are only after searching {*}core/camel-core{*}, as the ticket
description refers to *camel-core*
* If I do change tests in multiple different projects, I will submit separate
PR's
* Tried an automated scripted approach to change all - might use that later if
viable
!image-2024-07-16-08-27-07-290.png|width=1488,height=631!
> camel-core: review File tests for incorrectly shared resources
> --------------------------------------------------------------
>
> Key: CAMEL-20686
> URL: https://issues.apache.org/jira/browse/CAMEL-20686
> Project: Camel
> Issue Type: Task
> Components: camel-core
> Affects Versions: 4.6.0
> Reporter: Otavio Rodolfo Piske
> Assignee: Jang-Vijay Singh
> Priority: Major
> Labels: help-wanted
> Fix For: 4.x
>
> Attachments: 001_source_files_with_hello_or_input.txt,
> 002_source_files_with_general_txt_file_references.txt,
> IN_PROGRESS_With_occurrence_count.rtf, image-2024-07-16-08-27-07-290.png
>
>
> We have lots of file tests in core that run in parallel and try to write to
> the same file. This leads to a lot of flakiness in file tests.
>
> Look for tests doing things like {{testFile("output.txt")}} or
> {{testFile("input.txt")}} or other similar repetitive names (i.e.:
> {{{}foo{}}}, {{{}bar{}}}, etc) should be considered suspicious and need
> careful review.
>
> The tests should be adjusted to one of the following (in order of preference):
> * Use separate resources for each test (i.e: "{{{}input." +
> TestClass.class.getSimpleName() + ".txt"{}}})
> * Use JUnit's 5 temporary file provider
> * Use resource locks via JUnit's {{@ResourceLock}} annotation.
> * Or Isolated if safe to do so
--
This message was sent by Atlassian Jira
(v8.20.10#820010)