bryzgaloff commented on a change in pull request #10546:
URL: https://github.com/apache/airflow/pull/10546#discussion_r478076977



##########
File path: tests/providers/docker/operators/test_docker.py
##########
@@ -298,3 +249,22 @@ def test_execute_xcom_behavior(self, client_class_mock, 
tempdir_mock):
 
         self.assertEqual(xcom_push_result, b'container log')
         self.assertIs(no_xcom_push_result, None)
+
+    def test_extra_hosts(self):
+        hosts_obj = mock.Mock()
+        operator = \
+            DockerOperator(task_id='test', image='test', extra_hosts=hosts_obj)
+        operator.execute(None)
+        self.client_mock.create_container.assert_called_once()
+        self.assertIn(
+            'host_config',
+            self.client_mock.create_container.call_args.kwargs,
+        )
+        self.assertIn(
+            'extra_hosts',
+            self.client_mock.create_host_config.call_args.kwargs,
+        )
+        self.assertIs(
+            hosts_obj,
+            
self.client_mock.create_host_config.call_args.kwargs['extra_hosts'],
+        )

Review comment:
       Because we do not need to know which type `extra_hosts` argument is 
of.just need to  check that it is successfully passed to `create_host_config` 
call whatever the type is.




----------------------------------------------------------------
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:
[email protected]


Reply via email to