manipatnam commented on code in PR #63874:
URL: https://github.com/apache/airflow/pull/63874#discussion_r3338598761
##########
airflow-core/tests/unit/models/test_renderedtifields.py:
##########
@@ -372,6 +372,66 @@ def test_write(self, dag_maker):
{"bash_command": "echo test_val_updated", "env": None, "cwd":
None},
)
+ def test_write_upsert_existing_record(self, dag_maker, session):
+ """
+ Test that write() handles a pre-existing row without raising
IntegrityError.
+
+ The first row is seeded via a direct INSERT (bypassing write()),
simulating
+ a row already committed by the first SDK request. The second call goes
through
+ write() with different values, which must succeed and update the
record.
+
+ A plain INSERT statement would raise IntegrityError here; write() must
use a
+ database-level upsert to handle the conflict atomically. This is the
scenario
Review Comment:
Agreed, the old docstring overstated it. Reworded it
--
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]