quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.53k stars 2.61k forks source link

Test Harness support for testing crash resilience #27958

Open mmusgrov opened 1 year ago

mmusgrov commented 1 year ago

Description

The narayana JTA extension provides transaction support and a key feature provided by JTA is to be able to complete prepared transactions following failures in the environment such as networking issues or JVM crashes.

Issue #26160 added support for recovery but the test for is manual (https://github.com/zhfeng/quarkus-narayana-crash-recovery):

  1. start the quarkus app
  2. the app includes two resources a database and a dummy resource
  3. send an http request to the endpoint to crash the JVM when the dummy resource commits
  4. restart the quarkus app
  5. wait a while for recovery to kick in and verify that the JTA extension replays the failed commit request

It would be useful to be able to perform this kind of workflow using the test harness.

Implementation ideas

I'm not familiar with the test harness but maybe it could be implemented by extending testcontainers or by enhancing QuarkusTestResourceLifecycleManager.

geoand commented 1 year ago

This seems interesting, but is it really something general that Quarkus users would take advantage of?

mmusgrov commented 1 year ago

I think so because some quarkus users have a need to use global transactions (spanning more than one resource) and they would benefit from the knowledge that there are tests that verify recovery semantics.

Note that the request is to be used by extensions for testing and the JTA extension needs the functionality.

geoand commented 1 year ago

I can help out with technical advice on this, but as I don't really understand the use case, I can't lead this.

zhfeng commented 1 year ago

@geoand there is a similar test case in narayana xts crash-recovery-tests https://github.com/jbosstm/narayana/blob/master/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/BaseCrashTest.java#L192 but it is based on wildfly-arquillian. So I wonder if we can leverage on quarkus-arquillian as well?

geoand commented 1 year ago

If this is going to be user facing (which I am personally not 100% convinced it should), quarkus-aquillian is not an option.