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

vatsrahul1001 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-4-test by this push:
     new 6c46571772a [v3-4-test] Run the Kerberos renewer without metadata 
database checks (#75000) (#75467)
6c46571772a is described below

commit 6c46571772af0f25ffda70c78016bfec88893b90
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Oct 24 14:25:07 2026 +0000

    [v3-4-test] Run the Kerberos renewer without metadata database checks 
(#75000) (#75467)
    
    * Run the Kerberos renewer without metadata database checks
    
    Ticket initialization does not use the metadata database. Cover standard 
and one-time CLI dispatch when migration and log-template access are 
unavailable.
    
    Generated-by: OpenAI Codex
    
    * Use mock.patch decorators in the Kerberos no-database test
    
    Generated-by: Claude Opus 5
    
    ---------
    (cherry picked from commit fefb87a6035f9a223749ca6c42702d37eb5a32d5)
    
    Co-authored-by: Himanshu Chawla <[email protected]>
    Co-authored-by: Himanshu Chawla 
<[email protected]>
    Co-authored-by: Jarek Potiuk <[email protected]>
---
 .../src/airflow/cli/commands/kerberos_command.py   |  2 +-
 .../unit/cli/commands/test_kerberos_command.py     | 36 ++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/cli/commands/kerberos_command.py 
b/airflow-core/src/airflow/cli/commands/kerberos_command.py
index 05b4f860df5..7829a83ea3b 100644
--- a/airflow-core/src/airflow/cli/commands/kerberos_command.py
+++ b/airflow-core/src/airflow/cli/commands/kerberos_command.py
@@ -25,7 +25,7 @@ from airflow.utils import cli as cli_utils
 from airflow.utils.providers_configuration_loader import 
providers_configuration_loaded
 
 
-@cli_utils.action_cli
+@cli_utils.action_cli(check_db=False)
 @providers_configuration_loaded
 def kerberos(args):
     """Start a kerberos ticket renewer."""
diff --git a/airflow-core/tests/unit/cli/commands/test_kerberos_command.py 
b/airflow-core/tests/unit/cli/commands/test_kerberos_command.py
index 3fc5a822a76..d69792670cc 100644
--- a/airflow-core/tests/unit/cli/commands/test_kerberos_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_kerberos_command.py
@@ -37,6 +37,42 @@ class TestKerberosCommand:
     def setup_class(cls):
         cls.parser = cli_parser.get_parser()
 
+    @pytest.mark.parametrize("one_time", [False, True])
+    @conf_vars({("core", "executor"): "CeleryExecutor", ("database", 
"check_migrations"): "True"})
+    @mock.patch(
+        "airflow.utils.db.check_and_run_migrations",
+        autospec=True,
+        side_effect=RuntimeError("Metadata database unavailable"),
+    )
+    @mock.patch(
+        "airflow.utils.db.synchronize_log_template",
+        autospec=True,
+        side_effect=RuntimeError("Metadata database unavailable"),
+    )
+    @mock.patch("airflow.cli.commands.kerberos_command.krb.run", autospec=True)
+    def test_run_without_metadata_database(
+        self, mock_run, mock_synchronize_log_template, mock_check_migrations, 
one_time
+    ):
+        args = self.parser.parse_args(
+            [
+                "kerberos",
+                "PRINCIPAL",
+                "--keytab",
+                "/tmp/airflow.keytab",
+                *(["--one-time"] if one_time else []),
+            ]
+        )
+
+        kerberos_command.kerberos(args)
+
+        mock_check_migrations.assert_not_called()
+        mock_synchronize_log_template.assert_not_called()
+        mock_run.assert_called_once_with(
+            keytab="/tmp/airflow.keytab",
+            principal="PRINCIPAL",
+            mode=KerberosMode.ONE_TIME if one_time else KerberosMode.STANDARD,
+        )
+
     @mock.patch("airflow.cli.commands.kerberos_command.krb")
     @conf_vars({("core", "executor"): "CeleryExecutor"})
     def test_run_command(self, mock_krb):

Reply via email to