@@ -611,7 +611,7 @@ def test_submitJob(mocker, mockJWInput, expected):
611
611
("Pool/Singularity" , jobScript % "1" , (["Failed to find singularity" ], []), ([], [])),
612
612
],
613
613
)
614
- def test_submitAndCheckJob (mocker , manageJobFiles , localCE , job , expectedResult1 , expectedResult2 ):
614
+ def test_submitAndCheckJob (mocker , manageJobFiles , localCE , job , expectedResult1 , expectedResult2 , tmp_path ):
615
615
"""Test the submission and the management of the job status."""
616
616
jobID = "123"
617
617
jobExecutablePath , jobWrapperPath , jobWrapperConfigPath = manageJobFiles
@@ -635,7 +635,12 @@ def test_submitAndCheckJob(mocker, manageJobFiles, localCE, job, expectedResult1
635
635
),
636
636
)
637
637
mocker .patch ("DIRAC.WorkloadManagementSystem.Agent.JobAgent.JobAgent._sendFailoverRequest" , return_value = S_OK ())
638
- mocker .patch ("DIRAC.Core.Security.X509Chain.X509Chain.dumpAllToString" , return_value = S_OK ())
638
+ empty_file_path = tmp_path / "empty_file"
639
+ empty_file_path .touch ()
640
+ mocker .patch (
641
+ "DIRAC.WorkloadManagementSystem.Agent.JobAgent.writeChainToTemporaryFile" ,
642
+ return_value = S_OK (str (empty_file_path )),
643
+ )
639
644
mocker .patch (
640
645
"DIRAC.Resources.Computing.SingularityComputingElement.SingularityComputingElement.submitJob" ,
641
646
return_value = S_ERROR ("Failed to find singularity" ),
@@ -712,7 +717,7 @@ def test_submitAndCheckJob(mocker, manageJobFiles, localCE, job, expectedResult1
712
717
assert len (jobAgent .computingElement .taskResults ) == 0
713
718
714
719
715
- def test_submitAndCheck2Jobs (mocker ):
720
+ def test_submitAndCheck2Jobs (mocker , tmp_path ):
716
721
"""Test the submission and the management of the job status.
717
722
718
723
This time, a first job is successfully submitted, but the second submission fails.
@@ -728,7 +733,17 @@ def test_submitAndCheck2Jobs(mocker):
728
733
),
729
734
)
730
735
mocker .patch ("DIRAC.WorkloadManagementSystem.Agent.JobAgent.JobAgent._sendFailoverRequest" , return_value = S_OK ())
731
- mocker .patch ("DIRAC.Core.Security.X509Chain.X509Chain.dumpAllToString" , return_value = S_OK ())
736
+
737
+ def make_empty_file (* args , ** kwargs ):
738
+ """Create an empty file and return its path."""
739
+ empty_file_path = tmp_path / "empty_file"
740
+ empty_file_path .touch ()
741
+ return S_OK (str (empty_file_path ))
742
+
743
+ mocker .patch (
744
+ "DIRAC.WorkloadManagementSystem.Agent.JobAgent.writeChainToTemporaryFile" ,
745
+ make_empty_file ,
746
+ )
732
747
mocker .patch (
733
748
"DIRAC.Resources.Computing.InProcessComputingElement.InProcessComputingElement.submitJob" ,
734
749
side_effect = [S_OK (), S_ERROR ("ComputingElement error" )],
0 commit comments