vbottu commented on code in PR #61798:
URL: https://github.com/apache/airflow/pull/61798#discussion_r2868612495


##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/executors/test_kubernetes_executor.py:
##########
@@ -1932,3 +1932,163 @@ def 
test_kube_config_parse_worker_pod_pending_fatal_container_state_reasons(
             executor = KubernetesExecutor()
 
         assert 
executor.kube_config.worker_pod_pending_fatal_container_state_reasons == 
expected_result
+
+
+class TestKubernetesExecutorMultiTeam:
+    """Tests for AIP-67 multi-team support in KubernetesExecutor."""
+
+    def test_supports_multi_team(self):
+        """Test that KubernetesExecutor declares multi-team support."""
+        assert KubernetesExecutor.supports_multi_team is True
+
+    def test_global_executor_without_team_name(self):
+        """Test that global executor (no team) works correctly with backwards 
compatibility."""
+        executor = KubernetesExecutor()
+
+        # Verify executor has conf
+        assert hasattr(executor, "conf")
+        # On older Airflow versions, conf is the global AirflowConfigParser 
(no team_name attr).
+        # On newer versions, conf is an ExecutorConf with team_name=None.
+        assert getattr(executor.conf, "team_name", None) is None
+
+        # Verify KubeConfig was created with the executor's conf
+        assert executor.kube_config is not None
+
+    @pytest.mark.skipif(not AIRFLOW_V_3_2_PLUS, reason="Multi-team requires 
Airflow 3.2+")
+    def test_executor_with_team_name(self):
+        """Test that executor created with a team_name has team-specific 
conf."""
+        executor = KubernetesExecutor(team_name="ml_team")
+
+        assert executor.conf.team_name == "ml_team"
+        assert executor.team_name == "ml_team"
+        assert executor.kube_config is not None
+
+    @pytest.mark.skipif(not AIRFLOW_V_3_2_PLUS, reason="Multi-team requires 
Airflow 3.2+")
+    def test_multiple_team_executors_isolation(self, monkeypatch):
+        """Test that multiple team executors can coexist with isolated 
resources."""
+        # Set team-specific parallelism via env vars so KubeConfig picks them 
up
+        # parallelism is read from the 'core' section
+        monkeypatch.setenv("AIRFLOW__TEAM_A___CORE__PARALLELISM", "2")
+        monkeypatch.setenv("AIRFLOW__TEAM_B___CORE__PARALLELISM", "3")

Review Comment:
   Good call, swapped it to 
KUBERNETES_EXECUTOR__WORKER_PODS_CREATION_BATCH_SIZE. Makes more sense since 
that's actually a per executor setting that flows through 
[KubeConfig](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html),
 unlike 
[core.parallelism](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
 which the scheduler expects to be consistent.



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