0

In my service layer I'm extensively using CompletableFuture. There are bunch of methods going like this:

@Service
@AllArgsConstructor
public class CodeableConceptValidatorServiceImpl implements CodeableConceptValidatorService {

  private final Executor executor;

  @Override
  public CompletableFuture<Boolean> validateMedicinalProduct(
      Bundle bundle, List<CodeValidationRequestObject> requests, List<ValidationError> validationErrors) {
    return CompletableFuture.supplyAsync(
        //business logic
        return false;
        },
        executor);
  }

  //other methods here
}

I have exactly four test classes, every which has different number of @Test methods in it.

Example of a test class would be like this:

@SpringBootTest(properties = {"spring.cloud.config.enabled: false", "logging.level.path.to.main.class: OFF"})
public class MedicinalProductTest {

  @Autowired private Executor executor;

  //other dependencies


@Test
void testEmptyCodingsInProductClassification() throws ExecutionException, InterruptedException {
    List<ValidationError> errors = new ArrayList<>();
    List<CodeValidationRequestObject> requests = new ArrayList<>();

    boolean isOk =
        this.codeableConceptValidatorService.validateMedicinalProduct(medicinalProduct1, requests, errors).get();

    assertTrue(
        errors.stream()
            .map(ValidationError::getByErrorCode)
            .anyMatch(code -> code.equals(ByErrorCode.ERR_DRUG_5100.toString())));
    assertFalse(isOk);
  }

}

Jenkins pipeline is being defined in Jenkins file, which I will not post, since I'm not sure if something can be determined from there why builds are failing.

Output of the Jenkins server during build says, that Unit test are failing (the column "Unit test" is red). Here are some in my opinion relevant messages, since I don't want to dump entire output:

Section 1:

11:04:25  [2021-11-23 10:04:25.428] [SpringContextShutdownHook] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED paused.
11:04:26  [2021-11-23 10:04:25.561] [SpringContextShutdownHook] INFO  o.s.s.quartz.SchedulerFactoryBean - Shutting down Quartz Scheduler
11:04:26  [2021-11-23 10:04:25.561] [SpringContextShutdownHook] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED shutting down.
11:04:26  [2021-11-23 10:04:25.561] [SpringContextShutdownHook] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED paused.
11:04:26  [2021-11-23 10:04:25.569] [SpringContextShutdownHook] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED shutdown complete.
11:04:26  [2021-11-23 10:04:25.602] [SpringContextShutdownHook] INFO  o.s.s.c.ThreadPoolTaskExecutor - Shutting down ExecutorService 'applicationTaskExecutor'
11:04:26  [INFO] 
11:04:26  [INFO] Results:
11:04:26  [INFO] 
11:04:27  [INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0
11:04:27  [INFO] 
11:04:27  [INFO] ------------------------------------------------------------------------
11:04:27  [INFO] BUILD FAILURE
11:04:27  [INFO] ------------------------------------------------------------------------
11:04:27  [INFO] Total time:  06:16 min
11:04:27  [INFO] Finished at: 2021-11-23T10:04:27Z
11:04:27  [INFO] ------------------------------------------------------------------------
11:04:27  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project drug-registry-services: There are test failures.

Section 2:

11:04:34  [ERROR] Process Exit Code: 0
11:04:34  [ERROR]   at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:510)
11:04:34  [ERROR]   at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:457)
11:04:34  [ERROR]   at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:298)
11:04:34  [ERROR]   at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
11:04:35  [ERROR]   at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183)
11:04:35  [ERROR]   at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
11:04:35  [ERROR]   at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
11:04:35  [ERROR]   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
11:04:35  [ERROR]   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
11:04:35  [ERROR]   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
11:04:35  [ERROR]   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
11:04:36  [ERROR]   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
11:04:36  [ERROR]   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
11:04:36  [ERROR]   at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
11:04:36  [ERROR]   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
11:04:36  [ERROR]   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
11:04:36  [ERROR]   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
11:04:36  [ERROR]   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
11:04:36  [ERROR]   at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
11:04:37  [ERROR]   at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
11:04:37  [ERROR]   at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
11:04:37  [ERROR]   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:04:37  [ERROR]   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:04:37  [ERROR]   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:04:37  [ERROR]   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
11:04:38  [ERROR]   at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
11:04:38  [ERROR]   at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
11:04:38  [ERROR]   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
11:04:38  [ERROR]   at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
11:04:38  [ERROR] Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

Section 3:

12:17:57  [INFO] Results:
12:17:57  [INFO] 
12:17:57  [ERROR] Errors: 
12:17:57  [ERROR]   MedicinalProductPackagedTest.testBadCardinality:140 ? Execution ca.uhn.fhir.re...
    12:17:57  [ERROR]   MedicinalProductPackagedTest.testEmptyCodingsInPackageItem:108 ? Execution ca....
    12:17:57  [ERROR]   MedicinalProductPackagedTest.testMultiplePackageItems:124 ? Execution ca.uhn.f...

pom.xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <forkCount>4</forkCount> //since I have exactly four test classes
        <reuseForks>false</reuseForks>
    </configuration>
</plugin>

I have tried to pull things from here, both non combination worked https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html

Oh, using JDK 11 and Spring Boot 2.4.2

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Wrapper
  • 794
  • 10
  • 25
  • 1
    `Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?` Seems to me like the VM is dying for some reason, does this work locally? Maybe you need to increase the memory of the Jenkins JVM? https://stackoverflow.com/questions/23260057/the-forked-vm-terminated-without-saying-properly-goodbye-vm-crash-or-system-exi/64613465 – JCompetence Nov 23 '21 at 11:29
  • I'm reading and trying everything meaningful. Will try that as well and I'll updated the post once I try with that. In the meantime I tried true, same errors happend.. – Wrapper Nov 23 '21 at 11:32
  • Also reduce scope, by commenting out all other test classes and leave 1 to run and see :) good luck – JCompetence Nov 23 '21 at 11:33

0 Answers0