ferruzzi commented on code in PR #36722:
URL: https://github.com/apache/airflow/pull/36722#discussion_r1448088091
##########
tests/providers/amazon/aws/executors/ecs/test_ecs_executor.py:
##########
@@ -1086,3 +1089,31 @@ def test_start_health_check_config(self, set_env_vars):
executor.start()
ecs_mock.stop_task.assert_not_called()
+
+ def test_providing_both_capacity_provider_and_launch_type_fails(self,
set_env_vars):
+ os.environ[
+
f"AIRFLOW__{CONFIG_GROUP_NAME}__{AllEcsConfigKeys.CAPACITY_PROVIDER_STRATEGY}".upper()
+ ] = "[{'capacityProvider': 'cp1', 'weight': 5}, {'capacityProvider':
'cp2', 'weight': 1}]"
+ expected_error = (
+ "capacity_provider_strategy and launch_type are mutually
exclusive, you can not provide both."
+ )
+
+ with pytest.raises(ValueError, match=expected_error):
+ AwsEcsExecutor()
+
+ def test_providing_capacity_provider(self, set_env_vars):
+ valid_capacity_provider = (
+ "[{'capacityProvider': 'cp1', 'weight': 5}, {'capacityProvider':
'cp2', 'weight': 1}]"
+ )
+
+ os.environ[
+
f"AIRFLOW__{CONFIG_GROUP_NAME}__{AllEcsConfigKeys.CAPACITY_PROVIDER_STRATEGY}".upper()
+ ] = valid_capacity_provider
+
os.environ.pop(f"AIRFLOW__{CONFIG_GROUP_NAME}__{AllEcsConfigKeys.LAUNCH_TYPE}".upper())
Review Comment:
Tests added (pending static checks and CI passing locally) thanks for the
suggestion.
--
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]