File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from collections .abc import Callable
22from datetime import timedelta
3+ from unittest import mock
34
45import pytest
56from django .test import override_settings
@@ -549,3 +550,23 @@ def test_package_link_provenance_flags_merged_across_drvs(
549550 link .provenance_flags
550551 == ProvenanceFlags .PACKAGE_NAME_MATCH | ProvenanceFlags .PRODUCT_MATCH
551552 )
553+
554+
555+ @pytest .mark .xfail (reason = "Not implemented" , strict = True )
556+ def test_build_new_links_is_atomic (
557+ make_container : Callable [..., Container ],
558+ make_drv : Callable [..., NixDerivation ],
559+ ) -> None :
560+ make_drv (pname = "foo" )
561+ container = make_container (package_name = "foo" )
562+
563+ with mock .patch .object (
564+ DerivationClusterProposalLink .objects ,
565+ "bulk_create" ,
566+ side_effect = Exception ("simulated DB failure" ),
567+ ):
568+ with pytest .raises (Exception , match = "simulated DB failure" ):
569+ build_new_links (container )
570+
571+ # A retry must succeed after a failed first attempt
572+ assert build_new_links (container )
You can’t perform that action at this time.
0 commit comments