snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

@TestProfile and @TestHTTPResource don't play well with quarkus.http.test-port=0 #166

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 4 years ago

Describe the bug @TestProfile doesn't fully reset the environment in a way that @TestHTTPResource would work with random ports (ie set with quarkus.http.test-port=0 ). This might be a CDI issue?

Expected behavior If you create more than 1 test which relies on @TestHTTPResource and @TestProfile with random ports. I would expect each test to be able to run with a new random port and a new CDI injection for each object, and the HTTP server to be brought up correctly.

I would expect the URL to always point to the current server, and work regardless how many tests I have.

Actual behavior After running the first test the HTTP server isn't accessible using the injected URL for the endpoint. Perhaps it's running on a different port. But I wouldn't know.

To Reproduce Steps to reproduce the behavior:

  1. Create 2 unit test which include and use @TestHTTPResource and @QuarkusTest (see https://github.com/aubelsb2/quarkusrandomportprofiletestsissue for a minimal example)
  2. Run them both

Configuration

# Add your application.properties here, if applicable.
# https://quarkus.io/guides/config
quarkus.banner.enabled=false
%test.quarkus.http.test-port=0
%test.quarkus.http.test-ssl-port=0

Screenshots n/a

Environment (please complete the following information):

 - GraalVM version (if different from Java): 
``` GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)```
 - Quarkus version or git rev: 
```        <quarkus.version>1.7.0.Final</quarkus.version>

https://github.com/quarkusio/quarkus/issues/11688


$upstream:11688$