turbaszek commented on a change in pull request #9615:
URL: https://github.com/apache/airflow/pull/9615#discussion_r449011845



##########
File path: tests/providers/apache/spark/hooks/test_spark_submit.py
##########
@@ -748,3 +750,64 @@ def test_k8s_process_on_kill(self, mock_popen, 
mock_client_method):
         client.delete_namespaced_pod.assert_called_once_with(
             'spark-pi-edf2ace37be7353a958b38733a12f8e6-driver',
             'mynamespace', **kwargs)
+
+
+@pytest.mark.parametrize(
+    ("command", "expected"),
+    (
+        (
+            ("spark-submit", "foo", "--bar", "baz", "--password='secret'"),
+            "spark-submit foo --bar baz --password='******'",
+        ),
+        (
+            ("spark-submit", "foo", "--bar", "baz", '--password="secret"'),
+            'spark-submit foo --bar baz --password="******"',
+        ),
+        (
+            ("spark-submit", "foo", "--bar", "baz", "--password=secret"),
+            "spark-submit foo --bar baz --password=******",
+        ),
+        (
+            ("spark-submit", "foo", "--bar", "baz", "--password 'secret'"),
+            "spark-submit foo --bar baz --password '******'",
+        ),
+        (
+            ("spark-submit", "foo", "--bar", "baz", "--password secret"),
+            "spark-submit foo --bar baz --password ******",
+        ),
+        (
+            ("spark-submit", "foo", "--bar", "baz", '--password "secret"'),
+            'spark-submit foo --bar baz --password "******"',
+        ),
+        (
+            ("spark-submit", "foo", "--bar", "baz", "--secret='secret'"),
+            "spark-submit foo --bar baz --secret='******'",
+        ),
+        (
+            ("spark-submit", "foo", "--bar", "baz", "--foo.password='secret'"),
+            "spark-submit foo --bar baz --foo.password='******'",
+        ),
+        (
+            ("spark-submit",),
+            "spark-submit",
+        ),
+
+        (
+            ("spark-submit", "foo", "--bar", "baz", "--password \"secret'"),
+            "spark-submit foo --bar baz --password \"secret'",
+        ),
+        (
+            ("spark-submit", "foo", "--bar", "baz", "--password 'secret\""),
+            "spark-submit foo --bar baz --password 'secret\"",
+        ),
+    ),
+)
+def test_masks_passwords(command: str, expected: str) -> None:

Review comment:
       You can use https://pypi.org/project/parameterized/ in future we will 
probably migrate to pytest




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to