-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
Hi,
not sure if this is a bug here or in rest-assured or if I do something wrong.
I have a resource class in a lambda which I test via rest-assured. The mock-event-server ist configured with port 0 to use a random port (quarkus.lambda.mock-event-server.test-port=0).
With quarkus version up to 3.24.5 the test works fine. From version 3.25.0 the test failed with an IllegalArgumentException: Port must be greater than 0.
As far as I can see the difference and maybe the reason in the versions is the class DevServicesLambdaProcessor.
The change is that the method startEventServer do not set the system property with the actual port of the event server anymore and so rest-assured gets not the random port.
Expected behavior
Rest-assured should get the actual port of the event server.
Actual behavior
Rest-assured throws an IllegalArgumentException: Port must be greater than 0
How to Reproduce?
@singleton
@path("/")
public class FooResource {
@GET
@Path("bar")
public Response bar() {
return Response.ok("bar").build();
}
}
@QuarkusTest
@TestHTTPEndpoint(FooResource.class)
class FooResourceTest {
@Test
void testBar() {
given().when()
.contentType(ContentType.JSON)
.get("/bar")
.then()
.statusCode(HttpStatus.SC_OK);
}
}
In the application.properties
quarkus.lambda.mock-event-server.test-port=0
Output of uname -a
or ver
No response
Output of java -version
openjdk version "21.0.6" 2025-01-21 LTS OpenJDK Runtime Environment Corretto-21.0.6.7.1 (build 21.0.6+7-LTS) OpenJDK 64-Bit Server VM Corretto-21.0.6.7.1 (build 21.0.6+7-LTS, mixed mode, sharing)
Quarkus version or git rev
3.25.0
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
No response