You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "wkochman (via GitHub)" <gi...@apache.org> on 2026/08/11 11:25:51 UTC

[PR] Add active-polling stopConnector(Duration) to connector mock framework [nifi]

wkochman opened a new pull request, #11528:
URL: https://github.com/apache/nifi/pull/11528

   ### Summary
   
   The connector mock server previously stopped a Connector with a single fixed 10-second blocking wait (`connectorNode.stop(...).get(10, SECONDS)`). On slower shutdown paths (for example, a failed table still draining) this could time out even though the Connector node retries its stop internally and eventually reaches `STOPPED`, causing otherwise-passing tests to fail during teardown.
   
   This adds a timeout-aware, active-polling stop to the mock framework.
   
   ### Changes
   
   - `ConnectorTestRunner`: add a `default void stopConnector(Duration timeout)` overload (backward compatible for existing implementors).
   - `StandardConnectorMockServer`: initiate the async stop, then poll the Connector state until `STOPPED` within the given timeout instead of a single fixed wait (default budget 60s, 250ms poll interval). A healthy stop still returns immediately.
   - `StandardConnectorTestRunner`: pass the timeout through to the mock server.
   - `CreateConnectorIT`: new IT exercising the overload end-to-end against the real `GenerateAndLog` connector.
   
   ### Testing
   
   `CreateConnectorIT` (integration-tests profile) passes locally:
   `Tests run: 1, Failures: 0, Errors: 0, Skipped: 0` for `testStopConnectorWithTimeoutStopsRunningConnector`.
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-16183 Add active-polling stopConnector(Duration) to connector mock framework [nifi]

Posted by "markap14 (via GitHub)" <gi...@apache.org>.
markap14 commented on code in PR #11528:
URL: https://github.com/apache/nifi/pull/11528#discussion_r3760381167


##########
nifi-connector-mock-bundle/nifi-connector-mock-api/src/main/java/org/apache/nifi/mock/connector/server/ConnectorTestRunner.java:
##########
@@ -144,6 +144,19 @@ public interface ConnectorTestRunner extends Closeable {
      */
     void stopConnector();
 
+    /**
+     * Stops the Connector, waiting up to the given timeout for it to reach a stopped state. Implementations
+     * should actively poll the Connector's state until it is stopped or the timeout elapses, which is more
+     * tolerant of a flow that takes a while to quiesce (for example a failed table still draining) than the
+     * default stop budget.
+     *
+     * @param timeout the maximum duration to wait for the Connector to stop
+     * @throws RuntimeException if the timeout elapses before the Connector stops

Review Comment:
   An explicit timeout should probably result in a {{java.util.concurrent.TimeoutException}}, rather than a RuntimeException, no?



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-16183 Add active-polling stopConnector(Duration) to connector mock framework [nifi]

Posted by "wkochman (via GitHub)" <gi...@apache.org>.
wkochman commented on code in PR #11528:
URL: https://github.com/apache/nifi/pull/11528#discussion_r3761305003


##########
nifi-connector-mock-bundle/nifi-connector-mock-api/src/main/java/org/apache/nifi/mock/connector/server/ConnectorTestRunner.java:
##########
@@ -144,6 +144,19 @@ public interface ConnectorTestRunner extends Closeable {
      */
     void stopConnector();
 
+    /**
+     * Stops the Connector, waiting up to the given timeout for it to reach a stopped state. Implementations
+     * should actively poll the Connector's state until it is stopped or the timeout elapses, which is more
+     * tolerant of a flow that takes a while to quiesce (for example a failed table still draining) than the
+     * default stop budget.
+     *
+     * @param timeout the maximum duration to wait for the Connector to stop
+     * @throws RuntimeException if the timeout elapses before the Connector stops

Review Comment:
   make sense, I have changed it on the new method 



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-16183 Add active-polling stopConnector(Duration) to connector mock framework [nifi]

Posted by "markap14 (via GitHub)" <gi...@apache.org>.
markap14 merged PR #11528:
URL: https://github.com/apache/nifi/pull/11528


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-16183 Add active-polling stopConnector(Duration) to connector mock framework [nifi]

Posted by "wkochman (via GitHub)" <gi...@apache.org>.
wkochman commented on PR #11528:
URL: https://github.com/apache/nifi/pull/11528#issuecomment-5259061636

   The `Ubuntu Java 21` integration-tests leg failed on an unrelated flaky test, not on anything in this PR (which only touches `nifi-connector-mock-bundle`).
   
   The failure is in `nifi-couchbase-processors`:
   
   ```
   [ERROR] PutCouchbaseIT.testPutDocument:61 Expected all Transferred FlowFiles to go to success but 1 were routed to failure
   ```
   
   The backing Couchbase Testcontainer never came up:
   
   ```
   com.couchbase.client.core.error.ConfigException: Could not locate a single global configuration
   java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 10000ms in 'source(MonoDefer)'
   NativeIoException: recvAddress(..) failed with error(-104): Connection reset by peer
   ```
   
   So `PutCouchbase` routed a FlowFile to `failure` because the container was unreachable. All JDK 21/25 unit-test legs and the validation checks passed. A re-run of the failed job should clear it.


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org