dstandish commented on code in PR #27526:
URL: https://github.com/apache/airflow/pull/27526#discussion_r1016988746


##########
kubernetes_tests/test_kubernetes_pod_operator.py:
##########
@@ -387,8 +369,53 @@ def test_pod_resources(self):
         }
         assert self.expected_pod == actual_pod
 
-    def test_pod_affinity(self):
-        affinity = {
+    @pytest.mark.parametrize(
+        "val",
+        [
+            param(
+                k8s.V1Affinity(
+                    node_affinity=k8s.V1NodeAffinity(
+                        
required_during_scheduling_ignored_during_execution=k8s.V1NodeSelector(
+                            node_selector_terms=[
+                                k8s.V1NodeSelectorTerm(
+                                    match_expressions=[
+                                        k8s.V1NodeSelectorRequirement(
+                                            key="beta.kubernetes.io/os",
+                                            operator="In",
+                                            values=["linux"],
+                                        )
+                                    ]
+                                )
+                            ]
+                        )
+                    )

Review Comment:
   well, this was before my time, but obvs if you're using objects it can be 
helpful e.g. with autocomplete and validation.  
   but yeah it was actually kind of tricky to use. 
   
   maybe we should only be deprecating the airflow objects, and still support 
json or k8s object.
   
   but, note that this PR doesn't change anything related to deprecations.  it 
just gets rid of noise in the "backcompat" test, and moves legitimate 
"backcompat" tests inline with the main tests. which helps e.g. in this case 
becasue you can see side-by-side new vs "backcompat". in this particular test, 
there actually _wasn't_ any test of the "new" behavior previously (maybe 
because it's such a pain in the ass?) so i added that here.
   
   anyway, if any of you "looky lous" has an inclination to approve that would 
be welcome



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

Reply via email to