This is an automated email from the ASF dual-hosted git repository.

o-nikolas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new f1883a4829c Add missing Amazon provider unit tests (#73169)
f1883a4829c is described below

commit f1883a4829cbf9df6550fd4bc9fe59b117dc6971
Author: Vincent Hsiao <[email protected]>
AuthorDate: Fri Oct 23 05:54:52 2026 +0800

    Add missing Amazon provider unit tests (#73169)
    
    Cover BaseConfigKeys.__iter__ and the Batch executor's rejection of
    unsupported submit_job kwargs. Drop base_config_keys from
    OVERLOOKED_TESTS now that it has a test.
---
 .../tests/unit/always/test_project_structure.py    |  1 -
 .../aws/executors/batch/test_batch_executor.py     | 16 ++++++++++
 .../aws/executors/utils/test_base_config_keys.py   | 35 ++++++++++++++++++++++
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/airflow-core/tests/unit/always/test_project_structure.py 
b/airflow-core/tests/unit/always/test_project_structure.py
index 88a17745b89..100094f8f78 100644
--- a/airflow-core/tests/unit/always/test_project_structure.py
+++ b/airflow-core/tests/unit/always/test_project_structure.py
@@ -66,7 +66,6 @@ class TestProjectStructure:
             
"providers/amazon/tests/unit/amazon/aws/executors/ecs/test_ecs_executor_config.py",
             
"providers/amazon/tests/unit/amazon/aws/executors/aws_lambda/test_utils.py",
             
"providers/amazon/tests/unit/amazon/aws/executors/aws_lambda/docker/test_app.py",
-            
"providers/amazon/tests/unit/amazon/aws/executors/utils/test_base_config_keys.py",
             "providers/amazon/tests/unit/amazon/aws/operators/test_emr.py",
             
"providers/amazon/tests/unit/amazon/aws/operators/test_sagemaker.py",
             "providers/amazon/tests/unit/amazon/aws/sensors/test_emr.py",
diff --git 
a/providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor.py 
b/providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor.py
index d3a15f5e630..f238b8bf0a7 100644
--- 
a/providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor.py
+++ 
b/providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor.py
@@ -1265,6 +1265,22 @@ class TestBatchExecutorConfig:
         # Verify that tag names are exempt from the camel-case conversion.
         assert submit_kwargs["tags"] == templated_tags
 
+    @pytest.mark.parametrize(
+        ("submit_job_kwargs", "match"),
+        [
+            ({"nodeOverrides": {}}, "Multi-node jobs are not currently 
supported."),
+            ({"eksPropertiesOverride": {}}, "Eks jobs are not currently 
supported."),
+        ],
+    )
+    def test_rejects_unsupported_submit_job_kwargs(self, submit_job_kwargs, 
match):
+        submit_job_kwargs_env_key = (
+            
f"AIRFLOW__{CONFIG_GROUP_NAME}__{AllBatchConfigKeys.SUBMIT_JOB_KWARGS}".upper()
+        )
+        os.environ[submit_job_kwargs_env_key] = json.dumps(submit_job_kwargs)
+
+        with pytest.raises(KeyError, match=match):
+            batch_executor_config.build_submit_kwargs(conf)
+
     @pytest.mark.parametrize(
         ("submit_job_kwargs", "exec_config", "expected_result"),
         [
diff --git 
a/providers/amazon/tests/unit/amazon/aws/executors/utils/test_base_config_keys.py
 
b/providers/amazon/tests/unit/amazon/aws/executors/utils/test_base_config_keys.py
new file mode 100644
index 00000000000..2008af7e90c
--- /dev/null
+++ 
b/providers/amazon/tests/unit/amazon/aws/executors/utils/test_base_config_keys.py
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from airflow.providers.amazon.aws.executors.utils.base_config_keys import 
BaseConfigKeys
+
+
+class TestBaseConfigKeys:
+    def test_iter_returns_class_attribute_values(self):
+        class ConfigKeys(BaseConfigKeys):
+            FIRST = "first"
+            SECOND = "second"
+
+        assert set(ConfigKeys()) == {"first", "second"}
+
+    def test_iter_skips_dunder_attributes(self):
+        class ConfigKeys(BaseConfigKeys):
+            __test_key__ = "test_key"
+            PUBLIC = "public"
+
+        assert set(ConfigKeys()) == {"public"}

Reply via email to