o-nikolas commented on code in PR #73169:
URL: https://github.com/apache/airflow/pull/73169#discussion_r4095516830


##########
providers/amazon/tests/unit/amazon/aws/executors/aws_lambda/test_utils.py:
##########
@@ -0,0 +1,92 @@
+# 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
+
+import datetime as dt
+
+import pytest
+
+from airflow.providers.amazon.aws.executors.aws_lambda.utils import (
+    CONFIG_GROUP_NAME,
+    INVALID_CREDENTIALS_EXCEPTIONS,
+    AllLambdaConfigKeys,
+    InvokeLambdaKwargsConfigKeys,
+    LambdaQueuedTask,
+)
+
+
+class TestLambdaQueuedTask:
+    def test_stores_queue_metadata(self):
+        next_attempt_time = dt.datetime(2026, 9, 15, tzinfo=dt.timezone.utc)
+
+        queued_task = LambdaQueuedTask(
+            key="key",
+            command=["airflow", "tasks", "run"],
+            queue="default",
+            executor_config={"function_name": "function"},
+            attempt_number=2,
+            next_attempt_time=next_attempt_time,
+        )
+
+        assert queued_task.key == "key"
+        assert queued_task.command == ["airflow", "tasks", "run"]
+        assert queued_task.queue == "default"
+        assert queued_task.executor_config == {"function_name": "function"}
+        assert queued_task.attempt_number == 2
+        assert queued_task.next_attempt_time == next_attempt_time
+
+
+class TestLambdaConfigKeys:
+    def test_config_group_name(self):
+        assert CONFIG_GROUP_NAME == "aws_lambda_executor"
+
+    def test_invalid_credentials_exceptions(self):
+        assert INVALID_CREDENTIALS_EXCEPTIONS == [
+            "ExpiredTokenException",
+            "InvalidClientTokenId",
+            "UnrecognizedClientException",
+        ]
+
+    @pytest.mark.parametrize(
+        ("config_key", "expected"),
+        [
+            (InvokeLambdaKwargsConfigKeys.FUNCTION_NAME, "function_name"),
+            (InvokeLambdaKwargsConfigKeys.QUALIFIER, "function_qualifier"),
+        ],
+    )
+    def test_invoke_lambda_kwargs_config_keys_values(self, config_key, 
expected):
+        assert config_key == expected
+
+    @pytest.mark.parametrize(
+        ("config_key", "expected"),
+        [
+            (AllLambdaConfigKeys.FUNCTION_NAME, "function_name"),
+            (AllLambdaConfigKeys.QUALIFIER, "function_qualifier"),
+            (AllLambdaConfigKeys.AWS_CONN_ID, "conn_id"),
+            (AllLambdaConfigKeys.CHECK_HEALTH_ON_STARTUP, 
"check_health_on_startup"),
+            (AllLambdaConfigKeys.MAX_INVOKE_ATTEMPTS, "max_invoke_attempts"),
+            (AllLambdaConfigKeys.REGION_NAME, "region_name"),
+            (AllLambdaConfigKeys.QUEUE_URL, "queue_url"),
+            (AllLambdaConfigKeys.DLQ_URL, "dead_letter_queue_url"),
+            (AllLambdaConfigKeys.END_WAIT_TIMEOUT, "end_wait_timeout"),
+        ],
+    )
+    def test_all_lambda_config_keys_values(self, config_key, expected):
+        assert config_key == expected

Review Comment:
   I think as it stands now these are the only useful tests in this module. 
Testing against static strings isn't great because the defaults could get 
search and replaced and not notice the tests fail. If we want to ensure the 
values match what they should, check against the provider.yaml. Example here: 
https://github.com/apache/airflow/blob/9556dcf25b329a17a7a696648fabd3f716ef4501/providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor.py#L1145
   



##########
providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor_config.py:
##########


Review Comment:
   This is all duplicate, there is already a `TestBatchExecutorConfig` class in 
./providers/amazon/tests/unit/amazon/aws/executors/batch/test_batch_executor.py
   
   I think you can just move that here and maybe add any coverage to it that 
you think your tests have that it doesn't.



##########
providers/amazon/tests/unit/amazon/aws/auth_manager/datamodels/test_login.py:
##########


Review Comment:
   I'm not sure this test for a simple datamodel is helpful. I'd drop it. Let's 
not add these tests just for the sake of getting rid of entries in 
`OVERLOOKED_TESTS`, sometimes modules are in that list for a reason. But I'll 
let @vincbeck have the final say, since he knows auth manager stuff much better 
than I do.



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