This is an automated email from the ASF dual-hosted git repository.

markap14 pushed a commit to branch support/nifi-1.x
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 125e456a6439ed269edc74b3339070ffd95095a1
Author: Mark Payne <[email protected]>
AuthorDate: Mon Jun 12 14:47:01 2023 -0400

    NIFI-11471: Added a system test to verify controller service enable timeout.
    This closes #7242.
---
 .../apache/nifi/stateless/StatelessSystemIT.java   |  9 ++++
 .../basics/ControllerServiceLifecycleIT.java       | 53 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git 
a/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/StatelessSystemIT.java
 
b/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/StatelessSystemIT.java
index aa4e2845b7..411704ffc8 100644
--- 
a/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/StatelessSystemIT.java
+++ 
b/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/StatelessSystemIT.java
@@ -120,9 +120,18 @@ public class StatelessSystemIT {
             public String getStatusTaskInterval() {
                 return null;
             }
+
+            @Override
+            public String getComponentEnableTimeout() {
+                return StatelessSystemIT.this.getComponentEnableTimeout();
+            }
         };
     }
 
+    protected String getComponentEnableTimeout() {
+        return "10 sec";
+    }
+
     protected Optional<File> getContentRepoDirectory() {
         return Optional.empty();
     }
diff --git 
a/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/ControllerServiceLifecycleIT.java
 
b/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/ControllerServiceLifecycleIT.java
new file mode 100644
index 0000000000..bac8dddadf
--- /dev/null
+++ 
b/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/ControllerServiceLifecycleIT.java
@@ -0,0 +1,53 @@
+/*
+ * 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.nifi.stateless.basics;
+
+import org.apache.nifi.flow.VersionedControllerService;
+import org.apache.nifi.stateless.StatelessSystemIT;
+import org.apache.nifi.stateless.VersionedFlowBuilder;
+import org.apache.nifi.stateless.config.StatelessConfigurationException;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.concurrent.TimeoutException;
+
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+
+public class ControllerServiceLifecycleIT extends StatelessSystemIT {
+
+    @Override
+    protected String getComponentEnableTimeout() {
+        return "1 sec";
+    }
+
+    @Test
+    public void testControllerServices() throws IOException, 
StatelessConfigurationException, InterruptedException {
+        final VersionedFlowBuilder builder = new VersionedFlowBuilder();
+
+        final VersionedControllerService sleepService = 
builder.createSimpleControllerService("StandardSleepService", "SleepService");
+        sleepService.setProperties(Collections.singletonMap("@OnEnabled Sleep 
Time", "3 sec"));
+
+        try {
+            loadDataflow(builder.getFlowSnapshot());
+        } catch (final IllegalStateException expected) {
+            assertInstanceOf(TimeoutException.class, expected.getCause());
+        }
+    }
+
+}

Reply via email to