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


##########
nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorChangeVersionDrainIT.java:
##########
@@ -0,0 +1,247 @@
+/*
+ * 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 org.apache.nifi.components.connector.ConnectorState;
+import org.apache.nifi.flow.VersionedConnector;
+import org.apache.nifi.flow.VersionedConnectorState;
+import org.apache.nifi.tests.system.FlowDefinitionFiles;
+import org.apache.nifi.toolkit.client.NiFiClientException;
+import org.apache.nifi.web.api.dto.ConnectorValueReferenceDTO;
+import org.apache.nifi.web.api.entity.ConnectorEntity;
+import org.apache.nifi.web.api.entity.ParameterProviderEntity;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+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;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Single-node upgrade-drain scenarios for a version change.
+ */
+public class ConnectorChangeVersionDrainIT extends 
AbstractChangeVersionDrainIT {
+
+    private static final String UPGRADE_SECRET = "Upgrade Secret";
+    private static final String PROVIDER_NAME = "PropertiesParameterProvider";
+    private static final String SECRET_NAME = "upgrade-secret";
+    private static final String SECRET_FULLY_QUALIFIED_NAME = PROVIDER_NAME + 
".Parameters." + SECRET_NAME;
+
+    @Test
+    @Timeout(360)
+    public void testPreUpgradeParameterSecretIsRefreshedAndCanBeRestored() 
throws Exception {
+        final SecretConnector secretConnector = 
createSecretConnector("original-secret");
+        changeVersion(secretConnector.connectorId(), DRAIN_V2);
+        
getClientUtil().updateParameterProviderProperties(secretConnector.parameterProvider(),
 Map.of("parameters", SECRET_NAME + "=rotated-secret"));
+
+        restartKeepingIncomingVersion();
+        requestStart(secretConnector.connectorId());
+        getClientUtil().waitForConnectorState(secretConnector.connectorId(), 
ConnectorState.RUNNING);
+        assertNotPending(secretConnector.connectorId());

Review Comment:
   [Claude Opus 5.5] Renamed to 
`testPreUpgradeParameterSecretIsRefreshedAndCanBeRestored`. It now also checks 
that the secret is persisted as a reference rather than a value, and that the 
upgrade completes after the secret is rotated, and it now also asserts that the 
rotated value is what the flow uses. The restart case for sensitive values is 
covered by `ConnectorParameterContextIT`, which restarts without changing the 
version and checks that the processors still write the sensitive and asset 
values.



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