bobpaulin commented on code in PR #11872: URL: https://github.com/apache/nifi/pull/11872#discussion_r4606462050
########## nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorChangeVersionDrainIT.java: ########## @@ -0,0 +1,481 @@ +/* + * 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.components.connector.FlowEvolutionStatus; +import org.apache.nifi.flow.VersionedConnector; +import org.apache.nifi.flow.VersionedConnectorState; +import org.apache.nifi.flow.VersionedConnectorValueReference; +import org.apache.nifi.flow.VersionedParameter; +import org.apache.nifi.security.encryption.PropertyEncryptionEncoder; +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.dto.StateEntryDTO; +import org.apache.nifi.web.api.entity.ComponentStateEntity; +import org.apache.nifi.web.api.entity.ConnectionEntity; +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.io.IOException; +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.assertFalse; +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; + private static final String GENERATOR = "GenerateFlowFile"; + private static final String CANCELLED_EVOLUTION = "Flow evolution was cancelled"; + private static final String REWIRED_ENDPOINT = "Rewired Endpoint"; + + @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")); + + getNiFiInstance().stop(); Review Comment: [Claude Opus 5.5] Merged the four tests into testRestartKeepsPendingUpgrades, which sets up three Connectors and restarts once: a pending Connector with working-configuration edits and a secret; a Connector in Troubleshooting with an upgrade pending; a draining Connector with its own Gate File Path. The second restart that checked the saved flow is now a read while NiFi is running. The class restarts NiFi once. -- 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]
