airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] ashb commented on a change in pull request #4238: [AIRFLOW-987] pass kerberos cli args keytab and principal to kerberos…
Date Mon, 26 Nov 2018 17:52:32 GMT
ashb commented on a change in pull request #4238: [AIRFLOW-987] pass kerberos cli args keytab
and principal to kerberos…
URL: https://github.com/apache/incubator-airflow/pull/4238#discussion_r236360636
 
 

 ##########
 File path: tests/security/test_kerberos.py
 ##########
 @@ -32,13 +33,26 @@ def setUp(self):
 
         if not configuration.conf.has_section("kerberos"):
             configuration.conf.add_section("kerberos")
-
-        configuration.conf.set("kerberos",
-                               "keytab",
+        configuration.conf.set("kerberos", "keytab",
                                os.environ['KRB5_KTNAME'])
+        keytab_from_cfg = configuration.conf.get("kerberos", "keytab")
+        self.args = Namespace(keytab=keytab_from_cfg, principal=None, pid=None,
+                              daemon=None, stdout=None, stderr=None, log_file=None)
 
     def test_renew_from_kt(self):
         """
         We expect no result, but a successful run. No more TypeError
         """
-        self.assertIsNone(renew_from_kt())
+        self.assertIsNone(renew_from_kt(args=self.args))
+
+    def test_args_from_cli(self):
+        """
+        We expect no result, but a run with sys.exit(1) because keytab not exist.
+        """
+        configuration.conf.set("kerberos", "keytab", "")
+        self.args.keytab = "test_keytab"
+
+        with self.assertRaises(SystemExit) as se:
+            renew_from_kt(args=self.args)
 
 Review comment:
   What error is this hitting? Could you add some assertion of what error is logged too? (Probably
use https://docs.python.org/3.6/library/unittest.html#unittest.TestCase.assertLogs via the
backported `unittest2` which is already a dependency)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message