ashb commented on a change in pull request #13299:
URL: https://github.com/apache/airflow/pull/13299#discussion_r553265547



##########
File path: tests/kubernetes/test_pod_generator.py
##########
@@ -477,14 +478,36 @@ def test_construct_pod_empty_executor_config(self, 
mock_uuid):
         worker_config.metadata.annotations = self.annotations
         worker_config.metadata.labels = self.labels
         worker_config.metadata.labels['app'] = 'myapp'
-        worker_config.metadata.name = 'pod_id-' + self.static_uuid.hex
+        worker_config.metadata.name = 'pod_id.' + self.static_uuid.hex
         worker_config.metadata.namespace = 'namespace'
         worker_config.spec.containers[0].env.append(
             k8s.V1EnvVar(name="AIRFLOW_IS_K8S_EXECUTOR_POD", value='True')
         )
         worker_config_result = 
self.k8s_client.sanitize_for_serialization(worker_config)
         self.assertEqual(worker_config_result, sanitized_result)
 
+    def ensure_max_label_length(self):
+        path = sys.path[0] + 
'/tests/kubernetes/pod_generator_base_with_secrets.yaml'
+        worker_config = PodGenerator.deserialize_model_file(path)
+
+        result = PodGenerator.construct_pod(
+            dag_id='a' * 512,
+            task_id='a' * 512,
+            pod_id='a' * 512,
+            kube_image='a' * 512,
+            try_number=3,
+            date=self.execution_date,
+            args=['command'],
+            namespace='namespace',
+            scheduler_job_id='a' * 512,
+            pod_override_object=None,
+            base_worker_pod=worker_config,
+        )
+
+        assert result.metadata.name < 253

Review comment:
       Could we also add a specific check here, like we do elsxewhere in the 
file with
   
   ```
       @mock.patch('uuid.uuid4')
       def test_gen_pod_extract_xcom(self, mock_uuid):
           mock_uuid.return_value = self.static_uuid
   ```




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