You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/01/04 04:36:08 UTC

[GitHub] HyukjinKwon commented on a change in pull request #23441: [SPARK-26349][PYSPARK] Forbid insecure py4j gateways

HyukjinKwon commented on a change in pull request #23441: [SPARK-26349][PYSPARK] Forbid insecure py4j gateways
URL: https://github.com/apache/spark/pull/23441#discussion_r245202115
 
 

 ##########
 File path: python/pyspark/tests/test_context.py
 ##########
 @@ -246,6 +251,16 @@ def test_startTime(self):
         with SparkContext() as sc:
             self.assertGreater(sc.startTime, 0)
 
+    def test_forbid_insecure_gateway(self):
+        # Fail immediately if you try to create a SparkContext
+        # with an insecure gateway
+        mock_insecure_gateway = MagicMock()
+        mock_insecure_gateway.gateway_parameters = MagicMock()
+        mock_insecure_gateway.gateway_parameters.auth_token = None
 
 Review comment:
   @squito, I think it doesn't necessarily use mock .. I think it's okay to work around, for instnace by namedtuple:
   
   ```python
   from collections import namedtuple
   
   parameters = namedtuple('MockGatewayParameters', 'auth_token')(None)
   mock_insecure_gateway = namedtuple('MockJavaGateway', 'gateway_parameters')(parameters)
   ```

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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org