This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new b994c88324f NIFI-16034 Improved flaky system tests related to
Provenance Event Count expectations (#11362)
b994c88324f is described below
commit b994c88324f3ce47ceb1e277e815f349f8b21706
Author: Pierre Villard <[email protected]>
AuthorDate: Mon Jun 22 15:44:58 2026 +0200
NIFI-16034 Improved flaky system tests related to Provenance Event Count
expectations (#11362)
- Improved flaky system tests
ClassloaderIsolationWithControllerServicePropertyIT /
ClusteredReplayProvenanceIT
Signed-off-by: David Handermann <[email protected]>
---
.../system/parameters/ParameterContextIT.java | 1 +
...erIsolationWithControllerServicePropertyIT.java | 1 +
.../system/provenance/ReplayProvenanceIT.java | 23 ++++++++++++++++++++++
3 files changed, 25 insertions(+)
diff --git
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/parameters/ParameterContextIT.java
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/parameters/ParameterContextIT.java
index f0dc1976e55..7a9e8314236 100644
---
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/parameters/ParameterContextIT.java
+++
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/parameters/ParameterContextIT.java
@@ -612,6 +612,7 @@ public class ParameterContextIT extends NiFiSystemIT {
}
} finally {
getClientUtil().disableControllerService(serviceEntity);
+
getClientUtil().waitForControllerServiceRunStatus(serviceEntity.getId(),
"DISABLED");
getNifiClient().getControllerServicesClient().deleteControllerService(serviceEntity);
}
}
diff --git
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/processor/ClassloaderIsolationWithControllerServicePropertyIT.java
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/processor/ClassloaderIsolationWithControllerServicePropertyIT.java
index 7a8ed044c6c..482ce232ce7 100644
---
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/processor/ClassloaderIsolationWithControllerServicePropertyIT.java
+++
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/processor/ClassloaderIsolationWithControllerServicePropertyIT.java
@@ -76,6 +76,7 @@ public class
ClassloaderIsolationWithControllerServicePropertyIT extends NiFiSys
stopProcessorAndEmptyQueue(classloaderIsolationProcessor,
classloaderIsolationConnection);
getClientUtil().disableControllerService(service);
+ getClientUtil().waitForControllerServiceRunStatus(service.getId(),
"DISABLED");
getClientUtil().updateControllerServiceProperties(service,
Collections.singletonMap("Key Field", "Updated value"));
getClientUtil().enableControllerService(service);
diff --git
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/provenance/ReplayProvenanceIT.java
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/provenance/ReplayProvenanceIT.java
index fba7cdb8190..04e5e1f056e 100644
---
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/provenance/ReplayProvenanceIT.java
+++
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/provenance/ReplayProvenanceIT.java
@@ -17,16 +17,22 @@
package org.apache.nifi.tests.system.provenance;
+import org.apache.nifi.provenance.SearchableFields;
+import org.apache.nifi.provenance.search.SearchableField;
import org.apache.nifi.tests.system.NiFiSystemIT;
import org.apache.nifi.toolkit.client.NiFiClientException;
import org.apache.nifi.toolkit.client.ProvenanceClient.ReplayEventNodes;
+import org.apache.nifi.web.api.dto.provenance.ProvenanceSearchValueDTO;
import org.apache.nifi.web.api.entity.ConnectionEntity;
import org.apache.nifi.web.api.entity.ProcessorEntity;
+import org.apache.nifi.web.api.entity.ProvenanceEntity;
import org.apache.nifi.web.api.entity.ReplayLastEventResponseEntity;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import java.io.IOException;
+import java.util.Collections;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -52,6 +58,10 @@ public class ReplayProvenanceIT extends NiFiSystemIT {
waitForQueueCount(connection.getId(), 0);
getClientUtil().stopProcessor(terminate);
+ // Provenance events are indexed asynchronously after the FlowFile is
processed, and replaying the last event reads from
+ // that index on each node. Wait until every node has registered
terminate's event so that replaying across all nodes is deterministic.
+ waitForProvenanceEventCount(terminate.getId(), getNumberOfNodes());
+
// Replay last event for terminate and ensure that data is queued up.
final ReplayLastEventResponseEntity replayResponse =
getNifiClient().getProvenanceClient().replayLastEvent(terminate.getId(), nodes);
assertNull(replayResponse.getAggregateSnapshot().getFailureExplanation());
@@ -71,4 +81,17 @@ public class ReplayProvenanceIT extends NiFiSystemIT {
assertTrue(failureExplanation.contains(expectedFailureText),
failureExplanation);
}
+ private void waitForProvenanceEventCount(final String componentId, final
int expectedCount) throws InterruptedException {
+ final ProvenanceSearchValueDTO searchValue = new
ProvenanceSearchValueDTO();
+ searchValue.setValue(componentId);
+ searchValue.setInverse(false);
+
+ final Map<SearchableField, ProvenanceSearchValueDTO> searchTerms =
Collections.singletonMap(SearchableFields.ComponentID, searchValue);
+
+ waitFor(() -> {
+ final ProvenanceEntity provenanceEntity =
getClientUtil().queryProvenance(searchTerms, null, null);
+ return
provenanceEntity.getProvenance().getResults().getProvenanceEvents().size() >=
expectedCount;
+ }, 500L);
+ }
+
}