Junit tests fails in sonarqube but not in normal tests

SonarQube - Community Edition - Version 10.4.1 (build 88267) - Docker
Jenkins - 2.470
Java 17
Gradle 7.5.1

I have strange issue. Some of test run in Jenkins for Sonarqube failing, but if the same tests I run in normal pipeline (for example deploy to dev server) or inside my IDE they are passing.

Example of test:

RemoteXsdClient remoteXsdClient = new RemoteXsdClient(httpClient);
String remoteXsdUrl = "https://a-remote-xsd/file.xsd";
URL remoteXsdResource = XmlValidatorServiceTest.class.getResource("/file.xsd");
assertNotNull(remoteXsdResource);
String remoteXsdPath = remoteXsdResource.getFile();
byte[] remoteXsdRaw = Files.readAllBytes(Paths.get(remoteXsdPath)); //this is line 62

this line failing with error:

RemoteXsdClient > should get an xsd schema from a remote source and parse the file into a string FAILED
    java.nio.file.NoSuchFileException at RemoteXsdClientTest.java:62

but like I said, running it in other pipeline or even local I don’t get this kind of error.
I search there on forum and google but wasn’t successful yet. Maybe you will have better idea what’s could go wrong? It’s looks like under sonarqube it’s try to read file
I don’t write this tests, I try only implements sonar scans.

Hi,

Welcome to the community!

Only the latest version of SonarQube Community Build is considered active, so you’ll need to upgrade and see if the situation is still replicable before we can help you.

Your upgrade path is:

10.4.1 → 25.3

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your question, circumstances notwithstanding, I have a hard time believing this is directly related to analysis. But if you still see this after upgrade, post your full job log and we’ll take a look.

 
Ann