SameerMesiah97 commented on code in PR #76173:
URL: https://github.com/apache/airflow/pull/76173#discussion_r4433239197
##########
airflow-ctl/tests/airflow_ctl/ctl/commands/test_pool_command.py:
##########
@@ -64,6 +64,35 @@ def test_import_invalid_pool_config(self, mock_client,
tmp_path):
with pytest.raises(SystemExit, match="Invalid pool configuration:
{'invalid': 'config'}"):
pool_command.import_(mock.MagicMock(file=invalid_pool,
action_on_existing_key="fail"))
+ @pytest.mark.parametrize(
+ ("pool_config", "expected_reason"),
+ [
+ (
+ {"name": "bad_pool", "slots": "many"},
+ "slots: Input should be a valid integer, unable to parse
string as an integer",
+ ),
+ ({"name": "bad_pool", "slots": -5}, "slots: Input should be
greater than or equal to -1"),
+ (
+ {"name": "bad_pool", "slots": 1, "include_deferred": "maybe"},
+ "include_deferred: Input should be a valid boolean, unable to
interpret input",
+ ),
+ ({"name": None, "slots": 1}, "missing required field(s): name"),
+ ],
+ ids=["non-integer-slots", "slots-below-minimum",
"non-boolean-include-deferred", "null-name"],
+ )
Review Comment:
I think we could add 2 more test cases:
1) Valid pool followed by an invalid one (check the bulk API is still not
called)
2) Pool with both invalid slots and include_deferred (check both reasons
appear in the error)
--
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]