Hi, I think i figured it out.

org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer#updateLogProperties

File customPropertiesFile = new File(karafHome, framework.getKarafEtc() +
"/org.ops4j.pax.logging.cfg");
Properties karafPropertyFile = new Properties();
karafPropertyFile.load(new FileInputStream(customPropertiesFile));
loggingBackend.updatePaxLoggingConfiguration(karafPropertyFile,
realLogLevel);
karafPropertyFile.store(new FileOutputStream(customPropertiesFile),
"updated by pax-exam");


Here the file is updated, but the streams are never closed it seems.

Then later
in 
org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer#updateUserSetProperties

else if (optionToApply instanceof
KarafDistributionConfigurationFileReplacementOption) {

                        karafConfigurationFile

.replace(((KarafDistributionConfigurationFileReplacementOption)
optionToApply)
                                .getSource());
                        store = false;
                        break;
                    }

The class tries to replace the config file, which is still open. Ubuntu
(VM) allows it, but Windows fails (at least in my tests).

I think pax-exam version is 4.13.4.

Regards,
Vassil


На пн, 19.04.2021 г. в 21:36 ч. Васил Зорев <vassil.zore...@gmail.com>
написа:

> Thanks. Btw yes, i am on main branch (checked it out this weekend)
>
> На пн, 19.04.2021 г. в 21:33 ч. JB Onofré <j...@nanthrax.net> написа:
>
>> Ok, let me try on Windows VM.
>>
>> Regards
>> JB
>>
>> > Le 19 avr. 2021 à 20:27, Васил Зорев <vassil.zore...@gmail.com> a
>> écrit :
>> >
>> > The test passed in ubuntu. In windows I did the two steps you
>> suggested,
>> > but still got the same error.
>> >
>> > Regards,
>> > Vassil
>> >
>> > На пн, 19.04.2021 г. в 8:38 ч. Jean-Baptiste Onofre <j...@nanthrax.net>
>> > написа:
>> >
>> >> Hi,
>> >>
>> >> Yes mvn clean install should work. And it seems you try with karaf main
>> >> branch ?
>> >>
>> >> Can you try (even if it should not be required):
>> >>
>> >> 1. First: mvn clean install -DskipTests on root module
>> >> 2. Then: mvn clean install in the itest/test module
>> >>
>> >> In the meantime, I will try a full build on a Windows VM.
>> >>
>> >> Regards
>> >> JB
>> >>
>> >>> Le 18 avr. 2021 à 20:37, Васил Зорев <vassil.zore...@gmail.com> a
>> écrit
>> >> :
>> >>>
>> >>> no, same issue. (i guess you meant mvn clean install from the command
>> >> line,
>> >>> that's what i tried)
>> >>>
>> >>> Btw one (potentially dumb) question, do i have to build/run anything
>> else
>> >>> before running integration tests? So far I just built the root project
>> >> once
>> >>> without any tests.
>> >>>
>> >>> Regards,
>> >>> Have a nice evening
>> >>>
>> >>> На нд, 18.04.2021 г. в 21:01 ч. JB Onofré <j...@nanthrax.net> написа:
>> >>>
>> >>>> Does it work with maven directly ?
>> >>>>
>> >>>>> Le 18 avr. 2021 à 19:55, Васил Зорев <vassil.zore...@gmail.com> a
>> >> écrit
>> >>>> :
>> >>>>>
>> >>>>> JB,
>> >>>>>
>> >>>>> not sure what kind of test case do you mean? I tried executing
>> >>>>> org.apache.karaf.itests.BundleTest#listCommand as a single unit
>> test,
>> >>>> also
>> >>>>> as part of the maven build.
>> >>>>> I'll try to debug a bit more carefully, hopefully something comes
>> up..
>> >>>>>
>> >>>>> На нд, 18.04.2021 г. в 20:52 ч. Васил Зорев <
>> vassil.zore...@gmail.com>
>> >>>>> написа:
>> >>>>>
>> >>>>>> Hi,
>> >>>>>>
>> >>>>>> I tried initially in IntelliJ IDEA community 2020.3.2.
>> >>>>>>
>> >>>>>> Just tried in Eclipse Oxygen.3a (4.7.3a) and it failed with the
>> same
>> >>>>>> error. I'm currently setting up an ubuntu dev environment (also for
>> >>>> other
>> >>>>>> purposes) so when this is running i can try to run the test there
>> as
>> >>>> well.
>> >>>>>> Will let you know.
>> >>>>>>
>> >>>>>> Regards,
>> >>>>>> Vassil
>> >>>>>>
>> >>>>>> На нд, 18.04.2021 г. в 19:10 ч. Romain Manni-Bucau <
>> >>>> rmannibu...@gmail.com>
>> >>>>>> написа:
>> >>>>>>
>> >>>>>>> Hi
>> >>>>>>>
>> >>>>>>> Do you use eclipse or some IDE visiting target/ during the test?
>> Can
>> >>>> make
>> >>>>>>> it happen.
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> Le dim. 18 avr. 2021 à 17:48, Jean-Baptiste Onofre <
>> j...@nanthrax.net>
>> >> a
>> >>>>>>> écrit :
>> >>>>>>>
>> >>>>>>>> Hi Vassil,
>> >>>>>>>>
>> >>>>>>>> Don’t you have two tests running ?
>> >>>>>>>>
>> >>>>>>>> I never had this issue (but I’m not using Windows), and Jenkins
>> >> works
>> >>>>>>> fine.
>> >>>>>>>>
>> >>>>>>>> Do you have a simple test case to reproduce ?
>> >>>>>>>>
>> >>>>>>>> Regards
>> >>>>>>>> JB
>> >>>>>>>>
>> >>>>>>>>> Le 18 avr. 2021 à 12:58, Васил Зорев <vassil.zore...@gmail.com>
>> a
>> >>>>>>> écrit
>> >>>>>>>> :
>> >>>>>>>>>
>> >>>>>>>>> Reposted from the user mailing list:
>> >>>>>>>>>
>> >>>>>>>>> Hello,
>> >>>>>>>>>
>> >>>>>>>>> I tried to run some of the unit tests in the itests project to
>> >> check
>> >>>>>>> an
>> >>>>>>>> issue, but most of them failed. The most common error is that pax
>> >> exam
>> >>>>>>>> couldn't start the container as it failed to replace the
>> >>>>>>>> etc\org.ops4j.pax.logging.cfg file.
>> >>>>>>>>>
>> >>>>>>>>> Caused by: java.nio.file.FileSystemException:
>> >>>>>>>>
>> >>>>>>>
>> >>>>
>> >>
>> C:\Users\vasil\IdeaProjects\karaf\itests\test\target\exam\95aa38e2-a6a1-405e-8072-afe35347a34e\etc\org.ops4j.pax.logging.cfg:
>> >>>>>>>> The process cannot access the file because it is being used by
>> >> another
>> >>>>>>>> process.
>> >>>>>>>>> at
>> >>>>>>>>
>> >>>>>>>
>> >>>>
>> >>
>> java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
>> >>>>>>>>> ... (full log attached)
>> >>>>>>>>>
>> >>>>>>>>> I have checked out karaf sources version 4.2.12-SNAPSHOT from
>> some
>> >>>>>>> time
>> >>>>>>>> ago (probably a few months).
>> >>>>>>>>>
>> >>>>>>>>> Please find attached the intellij test log.
>> >>>>>>>>> It failed the same way when I executed the test as part of the
>> >> maven
>> >>>>>>>> build.
>> >>>>>>>>>
>> >>>>>>>>> I added a breakpoint at the place where the FileSystemException
>> is
>> >>>>>>>> thrown and examined the open file handles of this file in
>> >> Sysinternals
>> >>>>>>>> Process Explorer. Seems there are two open file handles for it,
>> both
>> >>>> by
>> >>>>>>> the
>> >>>>>>>> same java process that is executing the test (screenshots
>> attached).
>> >>>>>>>>>
>> >>>>>>>>> Please let me know if this is a known issue on my end if i can
>> >>>> already
>> >>>>>>>> resolve it, is it version dependent or something else? Also I can
>> >>>>>>> provide
>> >>>>>>>> further details if needed.
>> >>>>>>>>>
>> >>>>>>>>> Regards,
>> >>>>>>>>> Vassil
>> >>>>>>>>> <failed test.txt>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>
>> >>>>
>> >>
>> >>
>>
>>

Reply via email to