bobpaulin commented on code in PR #11872:
URL: https://github.com/apache/nifi/pull/11872#discussion_r4606451282


##########
nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorUpgradeDrainProviderIT.java:
##########
@@ -0,0 +1,132 @@
+/*
+ * 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.tests.system.connectors;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.nifi.components.connector.ConnectorState;
+import org.apache.nifi.util.NiFiProperties;
+import org.apache.nifi.web.api.dto.ConfigurationStepConfigurationDTO;
+import org.apache.nifi.web.api.dto.ConnectorConfigurationDTO;
+import org.apache.nifi.web.api.dto.PropertyGroupConfigurationDTO;
+import org.apache.nifi.web.api.entity.ConnectorEntity;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+/**
+ * A NAR-swap upgrade applies configuration supplied by the external provider.
+ */
+public class ConnectorUpgradeDrainProviderIT extends 
AbstractNarSwapUpgradeDrainIT {
+
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+    private static final String COMMENT = "Comment";
+    private static final String LEGACY_NOTE = "Legacy Note";
+    private static final String DRAIN_LABEL = "Drain Label";
+    private static final String SUPPLIED_COMMENT = "supplied-by-provider";
+
+    private final Path providerState = createProviderState();
+
+    @Override
+    protected Map<String, String> getNifiPropertiesOverrides() {
+        return 
Map.of(NiFiProperties.CONNECTOR_CONFIGURATION_PROVIDER_IMPLEMENTATION, 
"org.apache.nifi.connectors.tests.system.FileConnectorConfigurationProvider", 
NiFiProperties
+            .CONNECTOR_CONFIGURATION_PROVIDER_PROPERTIES_PREFIX + 
"state.directory", providerState.toAbsolutePath().toString());
+    }
+
+    @Test
+    @Timeout(240)
+    public void testProviderSuppliedConfigurationIsAppliedByUpgrade() throws 
Exception {
+        final Map<String, String> initial = properties("DRAIN", true, 
"shared");
+        initial.put(LEGACY_NOTE, "v1-only");
+        final String connectorId = createConnector("UpgradeDrainConnector", 
initial);
+
+        getNiFiInstance().stop();

Review Comment:
   [Claude Opus 5.5] The NAR-swap startup path is what this test checks: it's 
where the provider's working configuration gets merged into the pending 
restore, and a version change through REST takes a different path. So I folded 
it into ClusteredConnectorUpgradeDrainIT and deleted 
ConnectorUpgradeDrainProviderIT. The combined test, 
testNarSwapResumesRunningConnectorAndAppliesProviderConfiguration, uses one 
environment and one restart with two Connectors. One is stopped and has a 
working configuration edited in the provider. The other is running and resumes 
its upgrade.



-- 
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]

Reply via email to