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 073e0277a5a NIFI-16104 Fixed flaky ConnectorAssetsIT by polling for
asset removal (#11420)
073e0277a5a is described below
commit 073e0277a5a9bd52456dfad99e2826f37724f9cb
Author: Pierre Villard <[email protected]>
AuthorDate: Tue Jul 21 22:14:42 2026 +0200
NIFI-16104 Fixed flaky ConnectorAssetsIT by polling for asset removal
(#11420)
Signed-off-by: David Handermann <[email protected]>
---
.../apache/nifi/tests/system/NiFiClientUtil.java | 22 ++++++++++++++++++++++
.../tests/system/connectors/ConnectorAssetsIT.java | 11 ++---------
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiClientUtil.java
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiClientUtil.java
index 0deeb16f0d0..abe5a440530 100644
---
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiClientUtil.java
+++
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiClientUtil.java
@@ -83,6 +83,7 @@ import
org.apache.nifi.web.api.dto.status.ConnectionStatusSnapshotDTO;
import org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO;
import org.apache.nifi.web.api.dto.status.ProcessorStatusSnapshotDTO;
import org.apache.nifi.web.api.entity.ActivateControllerServicesEntity;
+import org.apache.nifi.web.api.entity.AssetsEntity;
import org.apache.nifi.web.api.entity.ConfigurationStepEntity;
import org.apache.nifi.web.api.entity.ConnectionEntity;
import org.apache.nifi.web.api.entity.ConnectionStatusEntity;
@@ -655,6 +656,27 @@ public class NiFiClientUtil {
}
}
+ public void waitForAssetRemoved(final String connectorId, final String
assetId)
+ throws NiFiClientException, IOException, InterruptedException {
+ int iteration = 0;
+ while (true) {
+ final AssetsEntity assetsEntity =
getConnectorClient().getAssets(connectorId);
+ final boolean assetStillPresent = assetsEntity.getAssets() != null
+ && assetsEntity.getAssets().stream()
+ .filter(a -> a.getAsset() != null)
+ .anyMatch(a ->
assetId.equals(a.getAsset().getId()));
+ if (!assetStillPresent) {
+ return;
+ }
+
+ if (iteration++ % 30 == 0) {
+ logger.info("Asset with ID {} is still present for Connector
{} but waiting for removal.", assetId, connectorId);
+ }
+
+ Thread.sleep(100L);
+ }
+ }
+
public ConnectorEntity drainConnector(final String connectorId) throws
NiFiClientException, IOException {
final ConnectorEntity entity =
getConnectorClient().getConnector(connectorId);
entity.setDisconnectedNodeAcknowledged(true);
diff --git
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorAssetsIT.java
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorAssetsIT.java
index 40a2bce775d..e02a3b3e5b0 100644
---
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorAssetsIT.java
+++
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorAssetsIT.java
@@ -188,15 +188,8 @@ public class ConnectorAssetsIT extends NiFiSystemIT {
getClientUtil().waitForConnectorState(connectorId,
ConnectorState.STOPPED);
- // Verify that the Asset has been removed from the Connector's Assets
list
- final AssetsEntity assetsAfterRemoval =
connectorClient.getAssets(connectorId);
- assertNotNull(assetsAfterRemoval);
-
- final boolean assetStillPresent = assetsAfterRemoval.getAssets() !=
null && assetsAfterRemoval.getAssets().stream()
- .filter(a -> a.getAsset() != null)
- .anyMatch(a -> uploadedAssetId.equals(a.getAsset().getId()));
-
- assertFalse(assetStillPresent);
+ // Wait for the Asset to be removed from the Connector's Assets list
+ getClientUtil().waitForAssetRemoved(connectorId, uploadedAssetId);
// Wait for Connector to stop before attempting to delete it.
getClientUtil().waitForConnectorStopped(connectorAfterApply.getId());