parkhojeong commented on code in PR #66370:
URL: https://github.com/apache/airflow/pull/66370#discussion_r3183395154


##########
airflow-ctl/tests/airflow_ctl/ctl/commands/test_config_command.py:
##########
@@ -158,6 +158,104 @@ def test_lint_detects_removed_configs(self, 
mock_rich_print, api_client_maker):
             in calls[1]
         )
 
+    @patch("airflowctl.api.client.Credentials.load")
+    @patch.dict(os.environ, {"AIRFLOW_CLI_TOKEN": "TEST_TOKEN"})
+    @patch.dict(os.environ, {"AIRFLOW_CLI_ENVIRONMENT": "TEST_CONFIG"})
+    @patch("rich.print")
+    @patch(
+        "airflowctl.ctl.commands.config_command.CONFIGS_CHANGES",
+        [
+            ConfigChange(
+                config=ConfigParameter("test_section", "test_option"),
+                was_removed=True,
+                remove_if_equals="matching_value",
+            ),
+        ],
+    )
+    def test_lint_detects_removed_configs_when_value_matches_remove_if_equals(
+        self, mock_rich_print, api_client_maker
+    ):
+        response_config = Config(
+            sections=[
+                ConfigSection(
+                    name="test_section",
+                    options=[
+                        ConfigOption(
+                            key="test_option",
+                            value="matching_value",
+                        )
+                    ],
+                )
+            ]
+        )
+
+        api_client = api_client_maker(
+            path="/api/v2/config",
+            response_json=response_config.model_dump(),
+            expected_http_status_code=200,
+            kind=ClientKind.CLI,
+        )
+        api_client.configs.list.return_value = response_config
+
+        config_command.lint(
+            self.parser.parse_args(["config", "lint"]),
+            api_client=api_client,
+        )
+
+        calls = [call[0][0] for call in mock_rich_print.call_args_list]
+        assert "[red]Found issues in your airflow.cfg:[/red]" in calls[0]
+        assert (
+            "- [yellow]Removed deprecated `test_option` configuration 
parameter from `test_section` section.[/yellow]"
+            in calls[1]
+        )
+
+    @patch("airflowctl.api.client.Credentials.load")
+    @patch.dict(os.environ, {"AIRFLOW_CLI_TOKEN": "TEST_TOKEN"})
+    @patch.dict(os.environ, {"AIRFLOW_CLI_ENVIRONMENT": "TEST_CONFIG"})
+    @patch("rich.print")
+    @patch(
+        "airflowctl.ctl.commands.config_command.CONFIGS_CHANGES",
+        [
+            ConfigChange(
+                config=ConfigParameter("test_section", "test_option"),
+                was_removed=True,
+                remove_if_equals="",
+            ),

Review Comment:
   Could we add a test where both `remove_if_equals=""` and the config 
`value=""`?
   
   The current test covers `remove_if_equals=""` with a non-matching value, but 
it does not verify that a matching empty string emits the removed-config 
warning.



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