pierrejeambrun commented on code in PR #32709:
URL: https://github.com/apache/airflow/pull/32709#discussion_r1281557441


##########
tests/cli/commands/test_pool_command.py:
##########
@@ -88,19 +100,34 @@ def test_pool_import_invalid_json(self):
             pool_command.pool_import(self.parser.parse_args(["pools", 
"import", "pools_import_invalid.json"]))
 
     def test_pool_import_invalid_pools(self):
-        pool_config_input = {"foo": {"description": "foo_test"}}
+        pool_config_input = {"foo": {"description": "foo_test", 
"include_deferred": False}}
         with open("pools_import_invalid.json", mode="w") as file:
             json.dump(pool_config_input, file)
 
         with pytest.raises(SystemExit):
             pool_command.pool_import(self.parser.parse_args(["pools", 
"import", "pools_import_invalid.json"]))
 
+    def test_pool_import_backwards_compatibility(self):
+        try:
+            pool_config_input = {
+                # JSON before version 2.7.0 does not contain `include_deferred`
+                "foo": {"description": "foo_test", "slots": 1},
+            }
+            with open("pools_import.json", mode="w") as file:
+                json.dump(pool_config_input, file)
+
+            pool_command.pool_import(self.parser.parse_args(["pools", 
"import", "pools_import.json"]))
+
+            assert self.session.query(Pool).filter(Pool.pool == 
"foo").first().include_deferred is False
+        finally:
+            os.remove("pools_import.json")

Review Comment:
   You can use the tmpdir fixture provided by pytest to not have to handle 
manually this tmp file lifecycle



##########
airflow/api_connexion/endpoints/pool_endpoint.py:
##########
@@ -155,3 +156,13 @@ def post_pool(*, session: Session = NEW_SESSION) -> 
APIResponse:
         return pool_schema.dump(pool)
     except IntegrityError:
         raise AlreadyExists(detail=f"Pool: {post_body['pool']} already exists")
+
+
+def _handle_missing_include_deferred(fields_diff: set) -> None:

Review Comment:
   This should be removed



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