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

Exception: ERROR java.nio.file.NoSuchFileException: /tmp/testngXmlPathInJar-15086412835569336174 #2761

Closed
martinaldrin opened this issue May 18, 2022 · 23 comments · Fixed by #2764

Comments

@martinaldrin
Copy link

martinaldrin commented May 18, 2022

TestNG Version

7.6.0

I have some bad news with last release 7.6.0, We tested a snapshot last week from master and that was working. But there seems to be a new commit in-between that affects us badly. non of the executions passed.

I expect it is related to this commit: d190ade

Seems that some tmp path is added infront of the path

argument: -xmlpathinjar suites/postrelease/emulator_wrat_postrelease.xml

Exception: 2022-05-18T08:44:26,315 ERROR java.nio.file.NoSuchFileException: /tmp/testngXmlPathInJar-15086412835569336174/suites/old_action_test_suites/rnc_action_regression_with_configurationdata.xml

Sample Test

package org.testng.sample;
import org.testng.annotations.Test;
public class XmlPathInJarTest {
		@Test
		public void test() {
			System.out.println("Test");
		}
}

Sample Suite

<suite name="MJE PostRelease test on G2Rbs" verbose="1">
    <test name="XmlPathInJarTest" preserve-order="true">
        <classes>
            <class name="org.testng.sample.XmlPathInJarTest" />
        </classes>
    </test>
</suite>

Command

java -classpath target/testng-sample-xmlpathinjar-0.0.1-SNAPSHOT-jar-with-dependencies.jar org.testng.TestNG -testjar target/testng-sample-xmlpathinjar-0.0.1-SNAPSHOT-jar-with-dependencies.jar -xmlpathinjar suites/xmlpathinjarSuite.xml

TestNG 7.5 Output

Test

===============================================
MJE PostRelease test on G2Rbs
Total tests run: 1, Passes: 1, Failures: 0, Skips: 0
===============================================

TestNg 7.6.0 Output

bash-3.2$ java -classpath target/testng-sample-xmlpathinjar-0.0.1-SNAPSHOT-jar-with-dependencies.jar org.testng.TestNG -testjar target/testng-sample-xmlpathinjar-0.0.1-SNAPSHOT-jar-with-dependencies.jar -xmlpathinjar suites/xmlpathinjarSuite.xml
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
13:10:47.078 [main] ERROR org.testng.TestNG - java.nio.file.NoSuchFileException: /var/folders/3l/qqzzwt655k16_hjq1gk_grl40000gp/T/testngXmlPathInJar-16857375091475056093/META-INF/maven/com.google.code.findbugs/jsr305/pom.xml
@krmahadevan
Copy link
Member

@martinaldrin - Can you please help add a sample that I can use to reproduce the problem ?

@martinaldrin
Copy link
Author

@martinaldrin - Can you please help add a sample that I can use to reproduce the problem ?

Added Example code and command above.

@martinaldrin
Copy link
Author

I did some testing and reverted one line, so it seems to be working if I switch back this line.

image

d190ade#diff-2be212be737b88302f4058b07a51c8731b5480f824a6fe98a85354e38a9fff95L79

@martinaldrin
Copy link
Author

martinaldrin commented May 19, 2022

After more investigation I found the issue, I copied the file check from the old method and added that infront of the copy method and that seems to solve the issue. We need to ensure that the parent directories exists before we copy the file.

 File file = java.nio.file.Files.createTempDirectory("testngXmlPathInJar-").toFile();
      if (!file.exists()) {
        file.mkdirs();
      }

@martinaldrin
Copy link
Author

I have created a PR now for the issue, but I have no idea about how to create unit tests for the issue.

krmahadevan added a commit to krmahadevan/testng that referenced this issue May 19, 2022
Closes testng-team#2761

Also toggled the version back to a bug fix version
krmahadevan added a commit to krmahadevan/testng that referenced this issue May 19, 2022
Closes testng-team#2761

Also toggled the version back to a bug fix version
krmahadevan added a commit to krmahadevan/testng that referenced this issue May 19, 2022
Closes testng-team#2761

Also toggled the version back to a bug fix version
krmahadevan added a commit to krmahadevan/testng that referenced this issue May 20, 2022
Closes testng-team#2761

Also toggled the version back to a bug fix version
krmahadevan added a commit that referenced this issue May 22, 2022
Closes #2761

Also toggled the version back to a bug fix version
@krmahadevan
Copy link
Member

@martinaldrin - Can you please check this version and see if all is well ?

https://oss.sonatype.org/content/repositories/snapshots/org/testng/testng/7.6.1-SNAPSHOT/

@martinaldrin
Copy link
Author

martinaldrin commented May 23, 2022

Hi, Yes I will try it.
I can't access Snapshots from our CI. but I built a fork from last Friday with your PR and test is ongoing with that.

@martinaldrin
Copy link
Author

Hi,

I can see that this issue is resolved, our test has passed.
But it can take some days before my commit is used in all our Test loops to be ensure that there is not other bugs introduced. But I see that as very low risk since my last test was based on a commit from 9th of May and that was working fine.

@krmahadevan
Copy link
Member

@martinaldrin - Can you please check this once again against 7.6.1-SNAPSHOT. We plan to do a bug fix release over the weekend and would like to ensure that all is well.

@martinaldrin
Copy link
Author

@krmahadevan We have been running a fork from your PR during for days now and it seems to works well. Many thanks for fast fix.

If you have submitted any new changes after this fix I have hard to try it during the weekend since we have vacation today and tomorrow.

@martinaldrin
Copy link
Author

martinaldrin commented May 31, 2022

I did a new test since my latest fork test last week and now I get a new issue.
Did you remove a method ?

Exception in thread "main" java.lang.NoSuchMethodError: 'void org.testng.reporters.Files.copyFile(java.io.InputStream, java.io.File)'
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
at.testng.JcatNGSuiteListener.writeSuiteXMLFiles(JcatNGSuiteListener.java:258)
at.JcatNGSuiteListener.processSuiteXMLFiles(JcatNGSuiteListener.java:210)
at .JcatNGSuiteListener.generateReport(JcatNGSuiteListener.java:197)
at.ListenerHandler.generateReport(ListenerHandler.java:709)
at.MsranTestNgListener.generateReport(MsranTestNgListener.java:916)
at org.testng.TestNG.generateReports(TestNG.java:1134)
at org.testng.TestNG.run(TestNG.java:1072)
at org.testng.TestNG.privateMain(TestNG.java:1414)
at org.testng.TestNG.main(TestNG.java:1378)

@krmahadevan
Copy link
Member

@martinaldrin - Yes we removed that deprecated method.

@martinaldrin
Copy link
Author

Thanks, then it will take a bit longer for me to verify since then other projects needs to be updated.

@krmahadevan
Copy link
Member

Sure. I can wait to hear back.

@martinaldrin
Copy link
Author

@krmahadevan I have now been running latest TestNg for 3 days and everything seems to be working fine so far.

@martinaldrin
Copy link
Author

Hi @krmahadevan do you still plan to do the bug fix release for 7.6.1 or do you plan to include more fixes before the release?

@krmahadevan
Copy link
Member

Hi @krmahadevan do you still plan to do the bug fix release for 7.6.1 or do you plan to include more fixes before the release?

Yes if this fix is absolutely the immediately needed for you folks to consume 7.6.0 else we can stall it to 7.7.0 which is probably atleast a couple of months away.

Let me know how you want it.

@martinaldrin
Copy link
Author

Hi, yes this fix is required for us. Not a single test can pass at the moment with 7.6.0 since all our executions uses xmlPathInJar.

@krmahadevan
Copy link
Member

@martinaldrin

I have published a release candidate for 7.6.1

You can get access to it by adding a repository entry such as below

        <repository>
            <id>maven-central-staging</id>
            <url>https://oss.sonatype.org/content/repositories/orgtestng-1082</url>
        </repository>

or if you are using Gradle, please add

repositories {
    mavenCentral()

    maven {
        url 'https://oss.sonatype.org/content/repositories/orgtestng-1082' }
}

and add a dependency on to TestNG 7.6.1 and let me know if all is well.
Once I hear back from you, I will go ahead and finish the release process by releasing the version from the Nexus Staging repository.

@bobshie
Copy link
Contributor

bobshie commented Jun 22, 2022

@krmahadevan , I'll test the TestNG version 7.6.1 rc version. and come back here after several days.
Thanks.

@bobshie
Copy link
Contributor

bobshie commented Jun 29, 2022

@krmahadevan, We have done the test and don't find any new issue on the version.
https://oss.sonatype.org/content/repositories/orgtestng-1082/org/testng/testng/7.6.1/testng-7.6.1.jar
Thanks.

@krmahadevan
Copy link
Member

@bobshie TestNG bug fix version 7.6.1 has now been released and is available on maven central. https://repo1.maven.org/maven2/org/testng/testng/7.6.1/

The tag creation part is going to have to wait since I would be out travelling for the next couple of days. I will come back and create the tag later.

@bobshie
Copy link
Contributor

bobshie commented Jul 4, 2022

@krmahadevan , OK, Very thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants