Integration test having issue as saga is working on first time and not working on subsequent calls

We were having integration test without saga implementation in place, it was working fine.
Once saga is introduced, saga is working as expected on first test. any subsequent tests are not working as expected if saga is involved.

We are cleaning up database and purge axon events before each test method invocation
ex. restClient.delete(format("http://localhost:%d/v1/devmode/purge-events", axonPort));

When we run application saga is working as expected. Only integration test has this problem.

Do you have any recommendation to overcome this problem.

What is used for the saga store in the integration tests? For example, if a JPA Sagastore is used with an h2 database, you likely also need to clean up the saga store table in the cleanup. Currently, you remove the events but not necessarily the sagas created based on those events.

Thanks Gerard for looking into this and for your immediate response.
We are using JPA and we are cleaning up database on every test using DbRider @DataSet(cleanBefore = true)

    void setUp() {

        Awaitility.setDefaultTimeout(TIMEOUT, MINUTES);
        restClient.delete(format("http://localhost:%d/v1/devmode/purge-events", axonPort));

    @DataSet(cleanBefore = true)
    final void shouldCreateFriendRequest() {


    @DataSet(cleanBefore = true)
    final void shouldHaveIdempotentCreateFriendRequest() {
        createFriendshipRequest(RECIPIENT_PLAYER_ID, SENDER_PLAYER_ID).statusCode(is(OK.value()));
        await().until(processed(SENDER_PLAYER_ID, RECIPIENT_PLAYER_ID));

        createFriendshipRequest(RECIPIENT_PLAYER_ID, SENDER_PLAYER_ID).statusCode(is(OK.value()));

    private Callable<Boolean> processed(final String senderPlayerId, final String recipientPlayerId) {
        return () -> {
            try {
                receivedFriendshipRequestRepository.getById(new ReceivedFriendshipRequestId(
                        recipientPlayerId, senderPlayerId));
                sentFriendshipRequestRepository.getById(new SentFriendshipRequestId(
                        senderPlayerId, recipientPlayerId));
                return true;
            } catch (ReceivedFriendshipRequestRepository.ReceivedFriendshipRequestNotFoundException
                     | SentFriendshipRequestRepository.SentFriendshipRequestNotFoundException e) {
                return false;

Is there anything else we need to do apart from database cleanup and event purging?

I don’t think you need to do something else, but I haven’t used DBRider. I did notice in a Spring Boot example, they auto wired the repositories used. So I think you might need to do something similar, so that the saga store is indeed cleaned up.

Thanks Gerard for your feedback, Let me check whether the DBrider is cleaning up saga store