avivijay19 commented on code in PR #6069: URL: https://github.com/apache/fineract/pull/6069#discussion_r3633701556
########## fineract-client-feign/src/main/java/org/apache/fineract/client/feign/services/InternalExternalEventsApi.java: ########## @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.client.feign.services; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; + +/** + * Internal testing API for external events. These endpoints are only available when the TEST profile is active. + */ +public interface InternalExternalEventsApi { Review Comment: Removed from this PR. The commit `FINERACT-2621: Add CI-only diagnostics for missing external events in e2e` has been dropped from the branch and will be raised as a separate PR. Could you please confirm which JIRA issue that follow-up should be raised under, or whether a new one should be created? I will reference it in the commit message. ########## fineract-client-feign/src/main/java/org/apache/fineract/client/feign/FineractFeignClient.java: ########## @@ -478,6 +479,10 @@ public InternalCobApi internalCob() { return create(InternalCobApi.class); } + public InternalExternalEventsApi internalExternalEvents() { Review Comment: Removed from this PR. The commit `FINERACT-2621: Add CI-only diagnostics for missing external events in e2e` has been dropped from the branch and will be raised as a separate PR. Could you please confirm which JIRA issue that follow-up should be raised under, or whether a new one should be created? I will reference it in the commit message. ########## fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/EventProperties.java: ########## @@ -38,6 +38,13 @@ public class EventProperties { @Value("${fineract-test.event.verification-enabled}") private boolean eventVerificationEnabled; + /** Review Comment: Removed from this PR. The commit `FINERACT-2621: Add CI-only diagnostics for missing external events in e2e` has been dropped from the branch and will be raised as a separate PR. Could you please confirm which JIRA issue that follow-up should be raised under, or whether a new one should be created? I will reference it in the commit message. ########## fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/EventFailureDiagnostics.java: ########## @@ -0,0 +1,129 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.messaging; + +import static org.apache.fineract.client.feign.util.FeignCalls.ok; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.List; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.client.feign.FineractFeignClient; +import org.apache.fineract.test.messaging.config.EventProperties; +import org.apache.fineract.test.messaging.store.EventStore; +import org.springframework.stereotype.Component; + +/** + * Explains why an event assertion timed out. + * + * <p> + * An event only reaches the test through two independent stages: it must be persisted into {@code m_external_event} by + * the business transaction, and it must then be published to the broker by the "Send Asynchronous Events" job. A + * timeout alone cannot tell those apart, which makes intermittent CI failures hard to attribute. This queries the + * server for what it actually persisted so the log states which stage lost the event. + * + * <p> + * Only runs when {@code EVENT_FAILURE_DIAGNOSTICS_ENABLED} is set, and only after an assertion has already failed, so + * it never affects passing runs. Any error raised while gathering diagnostics is swallowed - it must never replace the + * original assertion failure. + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class EventFailureDiagnostics { Review Comment: Removed from this PR. The commit `FINERACT-2621: Add CI-only diagnostics for missing external events in e2e` has been dropped from the branch and will be raised as a separate PR. Could you please confirm which JIRA issue that follow-up should be raised under, or whether a new one should be created? I will reference it in the commit message. ########## fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java: ########## @@ -5848,8 +5850,16 @@ public void checkLoanBuyDownFeeAmortizationTransactionCreatedBusinessEvent(final .orElseThrow(() -> new IllegalStateException(String.format("No Buy Down Fee Amortization transaction found on %s", date))); Long buyDownFeeAmortizationTransactionId = buyDownFeeAmortizationTransaction.getId(); - eventAssertion.assertEventRaised(LoanBuyDownFeeAmortizationTransactionCreatedBusinessEvent.class, - buyDownFeeAmortizationTransactionId); + try { Review Comment: Removed from this PR. The commit `FINERACT-2621: Add CI-only diagnostics for missing external events in e2e` has been dropped from the branch and will be raised as a separate PR. Could you please confirm which JIRA issue that follow-up should be raised under, or whether a new one should be created? I will reference it in the commit message. ########## fineract-e2e-tests-core/src/test/resources/fineract-test-application.properties: ########## @@ -38,14 +38,15 @@ fineract-test.messaging.jms.topic-name=${ACTIVEMQ_TOPIC_NAME:} fineract-test.event.verification-enabled=${EVENT_VERIFICATION_ENABLED:false} fineract-test.event.wait-timeout-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:5000} -fineract-test.event.delay-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:100} -fineract-test.event.interval-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:100} +fineract-test.event.delay-in-ms=${POLLING_EVENT_DELAY_IN_MS:100} +fineract-test.event.interval-in-ms=${POLLING_EVENT_INTERVAL_IN_MS:100} +fineract-test.event.failure-diagnostics-enabled=${EVENT_FAILURE_DIAGNOSTICS_ENABLED:false} Review Comment: Removed from this PR. The commit `FINERACT-2621: Add CI-only diagnostics for missing external events in e2e` has been dropped from the branch and will be raised as a separate PR. Could you please confirm which JIRA issue that follow-up should be raised under, or whether a new one should be created? I will reference it in the commit message. ########## fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/event/EventCheckHelper.java: ########## @@ -184,6 +184,24 @@ private void loanAccountDataV1Check(Class<? extends AbstractLoanEvent> eventClaz GetLoansLoanIdResponse body = ok(() -> fineractClient.loans().retrieveOneLoan(loanId, Map.of("staffInSelectedOfficeOnly", false, "associations", "all", "exclude", "", "fields", ""))); + // Earlier steps may have raised events of the same type for this loan; assertEvent consumes the Review Comment: Reverted. This will be included in the same e2e follow-up PR. Could you please confirm the JIRA issue to be used for that PR, or whether a new one should be created? ########## fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceImpl.java: ########## @@ -52,6 +54,7 @@ public BusinessDateDTO updateBusinessDate(BusinessDateDTO businessDateDto) { } @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) Review Comment: Reverted, together with the retry in both tasklets and the unit tests covering it. For the record ahead of the follow-up: `INCREASE_BUSINESS_DATE_BY_1_DAY` and `INCREASE_COB_DATE_BY_1_DAY` can execute concurrently and both insert the initial `m_business_date` row, causing one of them to fail on a duplicate key. It manifested on this branch as a `SchedulerJobsTest` failure on the MySQL shard. It is nevertheless a pre-existing race condition rather than one introduced by Spring Boot 4, so I agree it does not belong in this PR. I will raise it separately, using an upsert rather than a retry, which is the more appropriate fix. Could you please confirm which JIRA issue I should raise this under, or whether a new one should be created? I will reference it in the commit message. ########## fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasebusinessdateby1day/IncreaseBusinessDateBy1DayTasklet.java: ########## @@ -39,7 +41,13 @@ public class IncreaseBusinessDateBy1DayTasklet implements Tasklet { @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { if (configurationDomainService.isBusinessDateEnabled()) { - businessDateWritePlatformService.increaseDateByTypeByOneDay(BusinessDateType.BUSINESS_DATE); Review Comment: Reverted, together with the retry in both tasklets and the unit tests covering it. For the record ahead of the follow-up: `INCREASE_BUSINESS_DATE_BY_1_DAY` and `INCREASE_COB_DATE_BY_1_DAY` can execute concurrently and both insert the initial `m_business_date` row, causing one of them to fail on a duplicate key. It manifested on this branch as a `SchedulerJobsTest` failure on the MySQL shard. It is nevertheless a pre-existing race condition rather than one introduced by Spring Boot 4, so I agree it does not belong in this PR. I will raise it separately, using an upsert rather than a retry, which is the more appropriate fix. Could you please confirm which JIRA issue I should raise this under, or whether a new one should be created? I will reference it in the commit message. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
