highfly22 commented on pull request #12441:
URL: https://github.com/apache/airflow/pull/12441#issuecomment-730186825


   @potiuk I have no idea on the following failed case. Could you give any clue?
   
   ```
   self = 
<kubernetes_tests.test_kubernetes_pod_operator_backcompat.TestKubernetesPodOperatorSystem
 testMethod=test_xcom_push>
   
       def test_xcom_push(self):
           return_value = '{"foo": "bar"\n, "buzz": 2}'
           args = [f'echo \'{return_value}\' > /airflow/xcom/return.json']
           k = KubernetesPodOperator(
               namespace='default',
               image="ubuntu:16.04",
               cmds=["bash", "-cx"],
               arguments=args,
               labels={"foo": "bar"},
               name="test",
               task_id="task",
               in_cluster=False,
               do_xcom_push=True,
           )
           context = create_context(k)
           self.assertEqual(k.execute(context), json.loads(return_value))
           actual_pod = self.api_client.sanitize_for_serialization(k.pod)
           volume = 
self.api_client.sanitize_for_serialization(PodDefaults.VOLUME)
           volume_mount = 
self.api_client.sanitize_for_serialization(PodDefaults.VOLUME_MOUNT)
           container = 
self.api_client.sanitize_for_serialization(PodDefaults.SIDECAR_CONTAINER)
           self.expected_pod['spec']['containers'][0]['args'] = args
           self.expected_pod['spec']['containers'][0]['volumeMounts'].insert(0, 
volume_mount)  # noqa
           self.expected_pod['spec']['volumes'].insert(0, volume)
           self.expected_pod['spec']['containers'].append(container)
   >       self.assertEqual(self.expected_pod, actual_pod)
   E       AssertionError: {'api[40 chars]': {'namespace': 'default', 'name': 
<ANY>, 'an[998 chars]'}]}} != {'api[40 chars]': {'annotations': {}, 'labels': 
{'foo': 'bar'[1012 chars]'}]}}
   E         {'apiVersion': 'v1',
   E          'kind': 'Pod',
   E          'metadata': {'annotations': {},
   E                       'labels': {'airflow_version': '2.0.0b3',
   E                                  'dag_id': 'dag',
   E                                  'execution_date': 
'2016-01-01T0100000100-a2f50a31f',
   E                                  'foo': 'bar',
   E                                  'kubernetes_pod_operator': 'True',
   E                                  'task_id': 'task',
   E                                  'try_number': '1'},
   E       -               'name': <ANY>,
   E       +               'name': 'test-6c6eea1bc6974613815ef7ad04989ce8',
   E                       'namespace': 'default'},
   E          'spec': {'affinity': {},
   E                   'containers': [{'args': ['echo \'{"foo": "bar"\n'
   E                                            ', "buzz": 2}\' > '
   E                                            '/airflow/xcom/return.json'],
   E                                   'command': ['bash', '-cx'],
   E                                   'env': [],
   E                                   'envFrom': [],
   E                                   'image': 'ubuntu:16.04',
   E                                   'name': 'base',
   E                                   'ports': [],
   E                                   'resources': {},
   E                                   'volumeMounts': [{'mountPath': 
'/airflow/xcom',
   E                                                     'name': 'xcom'}]},
   E                                  {'command': ['sh',
   E                                               '-c',
   E                                               'trap "exit 0" INT; while 
true; do sleep '
   E                                               '30; done;'],
   E                                   'image': 'alpine',
   E                                   'name': 'airflow-xcom-sidecar',
   E                                   'resources': {'requests': {'cpu': '1m'}},
   E                                   'volumeMounts': [{'mountPath': 
'/airflow/xcom',
   E                                                     'name': 'xcom'}]}],
   E                   'hostNetwork': False,
   E                   'imagePullSecrets': [],
   E                   'initContainers': [],
   E       -           'nodeSelector': {},
   E                   'restartPolicy': 'Never',
   E                   'securityContext': {},
   E                   'serviceAccountName': 'default',
   E                   'tolerations': [],
   E                   'volumes': [{'emptyDir': {}, 'name': 'xcom'}]}}
   
   kubernetes_tests/test_kubernetes_pod_operator_backcompat.py:484: 
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]


Reply via email to