OmerJog commented on issue #6802: [AIRFLOW-6234] Allow override of k8s secret 
volume default mode
URL: https://github.com/apache/airflow/pull/6802#issuecomment-566666109
 
 
   @kevoriordan your PR breaks existing tests:
   ```
   __________________ TestPodGenerator.test_gen_pod_extract_xcom 
__________________
   self = <tests.kubernetes.test_pod_generator.TestPodGenerator 
testMethod=test_gen_pod_extract_xcom>
   mock_uuid = <MagicMock name='uuid4' id='140682249235480'>
       @mock.patch('uuid.uuid4')
       def test_gen_pod_extract_xcom(self, mock_uuid):
           mock_uuid.return_value = '0'
           pod_generator = PodGenerator(
               labels={'app': 'myapp'},
               name='myapp-pod',
               image_pull_secrets='pull_secret_a,pull_secret_b',
               image='busybox',
               envs=self.envs,
               cmds=['sh', '-c', 'echo Hello Kubernetes!'],
               namespace='default',
               security_context=k8s.V1PodSecurityContext(
                   run_as_user=1000,
                   fs_group=2000,
               ),
               ports=[k8s.V1ContainerPort(name='foo', container_port=1234)],
               configmaps=['configmap_a', 'configmap_b']
           )
           pod_generator.extract_xcom = True
           result = pod_generator.gen_pod()
           result = append_to_pod(result, self.secrets)
           result = self.resources.attach_to_pod(result)
           result_dict = self.k8s_client.sanitize_for_serialization(result)
           container_two = {
               'name': 'airflow-xcom-sidecar',
               'image': "alpine",
               'command': ['sh', '-c', PodDefaults.XCOM_CMD],
               'volumeMounts': [
                   {
                       'name': 'xcom',
                       'mountPath': '/airflow/xcom'
                   }
               ],
               'resources': {'requests': {'cpu': '1m'}},
           }
           self.expected['spec']['containers'].append(container_two)
           self.expected['spec']['containers'][0]['volumeMounts'].insert(0, {
               'name': 'xcom',
               'mountPath': '/airflow/xcom'
           })
           self.expected['spec']['volumes'].insert(0, {
               'name': 'xcom', 'emptyDir': {}
           })
           result_dict['spec']['containers'][0]['env'].sort(key=lambda x: 
x['name'])
   >       self.assertEqual(result_dict, self.expected)
   E       AssertionError: {'api[40 chars]': {'labels': {'app': 'myapp'}, 
'name': 'myapp[1490 chars]}}]}} != {'api[40 chars]': {'name': 'myapp-pod-0', 
'labels': {'app': '[1490 chars]00}}}
   E       Diff is 3538 characters long. Set self.maxDiff to None to see it.
   tests/kubernetes/test_pod_generator.py:214: AssertionError
   ```

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


With regards,
Apache Git Services

Reply via email to