mtilda commented on PR #25882:
URL: https://github.com/apache/airflow/pull/25882#issuecomment-1223520941
> I wonder if the this mutated name is accessible somewhere (need to keep
digging ⛏), or I can just
>
> ```py
> elif num_pods == 1 and pod.metadata.name.startswith(self.name):
> ```
Looking at the existing test code below, it looks like we are good to just
use `startswith` here.
```py
@pytest.mark.parametrize(("randomize_name",), ([True], [False]))
def test_full_pod_spec(self, randomize_name, pod_spec):
pod_spec_name_base = pod_spec.metadata.name
k = KubernetesPodOperator(
task_id="task",
random_name_suffix=randomize_name,
in_cluster=False,
do_xcom_push=False,
cluster_context="default",
full_pod_spec=pod_spec,
)
pod = self.run_pod(k)
if randomize_name:
assert pod.metadata.name.startswith(pod_spec_name_base)
assert pod.metadata.name != pod_spec_name_base
...
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]