Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x Helidon MP FaultTolerance fails In HelidonTest #8700

Open
tejo93 opened this issue Apr 25, 2024 · 4 comments
Open

4.x Helidon MP FaultTolerance fails In HelidonTest #8700

tejo93 opened this issue Apr 25, 2024 · 4 comments
Assignees
Labels
Projects

Comments

@tejo93
Copy link

tejo93 commented Apr 25, 2024

Environment Details

  • Helidon Version: 4.0.5
  • Helidon MP
  • JDK version: 21
  • OS: OL- 8 Linux
  • Docker version (if applicable): N/A

Setup:

I have this following configuration in src/main/resources/application.yaml

# Application properties. This is the default greeting
# Application properties. This is the default greeting
app:
  greeting: Hello
  someClient:
    baseUrl: http://someUrl
counter: 0

  # Microprofile server properties
server:
  port: 8080
  host: 0.0.0.0

io.helidon.examples.quickstart.mp.SomeClient/Retry/enabled: true
io.helidon.examples.quickstart.mp.SomeClient/Timeout/enabled: true
io.helidon.examples.quickstart.mp.SomeClient/Retry/maxRetries: 2
io.helidon.examples.quickstart.mp.SomeClient/Timeout/value: 5000

#Rest Client Properties for Some Client Service
someClient/mp-rest/url: "${app.someClient.baseUrl}"
someClient/mp-rest/connectTimeout: 5000
someClient/mp-rest/responseTimeout: 5000
someClient/mp-rest/propagateHeaders: Accept-Language

Class SomeClient is annotated like this :

@RegisterRestClient(configKey = "someClient")
@Retry
@Timeout
@Asynchronous
public interface SomeClient {
   
}

Method get :

 @GET
    @Produces("application/json")
    @Path("/somepath")
    CompletableFuture<Response> get();

Class SomeClientImpl has following changes

@RequestScoped
public class SomeClientImpl implements SomeClient {

    @Override
    public CompletableFuture<Response> get() {
        return CompletableFuture.completedFuture(Response.ok("Got").build());
    }
}

Class SomeClientService has following changes

@ApplicationScoped
public class SomeClientService {

    private final SomeClient someClient;
    @Inject
    public SomeClientService(@RestClient SomeClient someClient) {
        this.someClient = someClient;
    }

    public CompletableFuture<Response> get() {
        return someClient.get();
    }
}

I have test/resources/application.yaml

config_ordinal: 200
io.helidon.examples.quickstart.mp.SomeClient/Retry/enabled: false
io.helidon.examples.quickstart.mp.SomeClient/Timeout/enabled: false

Class MainTest

@HelidonTest
@AddConfig(key = "someClient/mp-rest/url", value = "http://localhost:9999")
@HoverflyCore(config = @HoverflyConfig(webServer = true, proxyPort = 9999))
@ExtendWith(HoverflyExtension.class)
class MainTest {

    @Inject
    private WebTarget target;

    @Inject
    @RestClient
    SomeClient someClient;

    @Test
    void testHelloWorld()  {
        CompletableFuture<Response> response = someClient.get();
        ExecutionException exception = assertThrows(ExecutionException.class, response::get);
        assertEquals(TimeoutException.class, exception.getCause().getClass());

    }
}

Issue :

When I execute the MainTest , it passes which should not happen as there is no delay set in the simulation.

helidon-quickstart-mp (1).zip

@github-actions github-actions bot added this to Triage in Backlog Apr 25, 2024
@tomas-langer
Copy link
Member

Seems to be related to #8478

@tomas-langer
Copy link
Member

Fixes should be in 4.0.7 (resetting FT cache).
Also the recommendation was to use config_ordinal: 500 for application.yaml, as 200 still conflicts with built-in config sources.

@tomas-langer
Copy link
Member

Attaching a diff that make the test fail as expected due to timeout.
I have remove completable future, as with Virtual threads, that is no longer needed.

@tomas-langer
Copy link
Member

@m0mus m0mus added the triage label Apr 25, 2024
@m0mus m0mus moved this from Triage to Sprint Scope in Backlog Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Backlog
  
Sprint Scope
Development

No branches or pull requests

3 participants