From 10e7840e887255ec610f976cc79425c6ab099750 Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Wed, 28 Aug 2024 20:53:05 +0200 Subject: [PATCH] test: fix SiteDirector test --- .../Agent/test/Test_Agent_SiteDirector.py | 5 +++++ tests/Integration/ResourceStatusSystem/Test_SiteStatus.py | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py b/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py index d005cf3bd87..d44513fbcec 100644 --- a/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py @@ -11,6 +11,7 @@ from DIRAC.ConfigurationSystem.Client import ConfigurationData from DIRAC.Core.Utilities.ProcessPool import S_OK from DIRAC.ResourceStatusSystem.Client.SiteStatus import SiteStatus +from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus from DIRAC.WorkloadManagementSystem.Agent.SiteDirector import SiteDirector from DIRAC.WorkloadManagementSystem.Client import PilotStatus @@ -166,6 +167,9 @@ def sd(mocker, config): mocker.patch( "DIRAC.WorkloadManagementSystem.Agent.SiteDirector.SiteStatus.getUsableSites", return_values=usableSites ) + mocker.patch( + "DIRAC.WorkloadManagementSystem.Agent.SiteDirector.ResourceStatus.getElementStatus", return_values=usableSites + ) sd = SiteDirector() # Set logger @@ -180,6 +184,7 @@ def sd(mocker, config): # Set queueDict sd.siteClient = SiteStatus() + sd.rssClient = ResourceStatus() sd._buildQueueDict() return sd diff --git a/tests/Integration/ResourceStatusSystem/Test_SiteStatus.py b/tests/Integration/ResourceStatusSystem/Test_SiteStatus.py index 7f7fd07f586..85bf2a1df68 100644 --- a/tests/Integration/ResourceStatusSystem/Test_SiteStatus.py +++ b/tests/Integration/ResourceStatusSystem/Test_SiteStatus.py @@ -57,21 +57,18 @@ def test_addAndRemove_simpleCase(stClient): result = stClient.getSites() assert result["OK"] is True, result["Message"] - assert testSite in result["Value"] # TEST getSiteStatuses # ............................................................................... result = stClient.getSiteStatuses([testSite]) assert result["OK"] is True, result["Message"] - assert result["Value"][testSite] == "Active" # TEST getUsableSites # ............................................................................... result = stClient.getUsableSites([testSite]) assert result["OK"] is True, result["Message"] - assert testSite in result["Value"] # finally delete the test site result = rsClient.deleteStatusElement("Site", "Status", testSite) @@ -138,14 +135,12 @@ def test_addAndRemove_complicatedTest(stClient): result = stClient.getSites("All") assert result["OK"] is True, result["Message"] - # TEST getUsableSites # ............................................................................... result = stClient.getUsableSites() assert result["OK"] is True, result["Message"] - # setting a status result = stClient.setSiteStatus("testBanned.test.test", "Probing") assert result["OK"] is True, result["Message"]