+
Skip to content

Embedded test server fails when running from mvn #35591

@stianst

Description

@stianst

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

dist/quarkus

Describe the bug

When running tests with the new tests framework with the embedded server mode the JVM is terminated unexpectedly.

org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

This is caused by the following code:

public void exit(int exitCode) {
// hard exit wanted, as build failed and no subsequent command should be executed. no quarkus involved.
System.exit(exitCode);
}

The changes around this was likely introduced by 799ee85

The embedded test server is started with:

Keycloak.Builder builder = Keycloak.builder().setVersion(Version.VERSION);
for(Dependency dependency : keycloakServerConfigBuilder.toDependencies()) {
builder.addDependency(dependency.getGroupId(), dependency.getArtifactId(), "");
}
keycloak = builder.start(keycloakServerConfigBuilder.toArgs());

Version

main

Regression

  • The issue is a regression

Expected behavior

Embedded Keycloak server is not terminated abruptly with System.exit

Actual behavior

System.exit is invoked causing Surefire VM to exit

How to Reproduce?

cd test-framework
KC_TEST_SERVER=embedded mvn clean install -Dtest=FancyRealmTest

To enable remote debugging edit test-framework/examples/tests/pom.xml and update config for surefire-plugin to:

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8787</argLine>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <java.util.concurrent.ForkJoinPool.common.threadFactory>io.quarkus.bootstrap.forkjoin.QuarkusForkJoinWorkerThreadFactory</java.util.concurrent.ForkJoinPool.common.threadFactory>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

Start tests, and run remote debugging from the IDE with a breakpoint on L197 in Picocli

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载