Skip to content

Commit

Permalink
added py3 HTTPS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Aug 3, 2021
1 parent 9bf42fa commit 66406bb
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Show setup command allows administrators to know which components, Services and

mardirac1.in2p3.fr >show setup
{'Agents': {'Configuration': ['CE2CSAgent'],
'Framework': ['CAUpdateAgent'],
'Framework': ['CAUpdateAgent'],
'WorkloadManagement': ['JobHistoryAgent',
'InputDataAgent',
'StalledJobAgent',
Expand All @@ -100,7 +100,7 @@ Show setup command allows administrators to know which components, Services and
'Notification',
'UserProfileManager',
'SystemAdministrator',
'ProxyManager'],
'ProxyManager'],
'RequestManagement': ['RequestManager'],
'WorkloadManagement': ['JobMonitoring',
'WMSAdministrator',
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/DISET/private/Service.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def initialize(self):
# Initialize Monitoring
# This is a flag used to check whether "EnableActivityMonitoring" is enabled or not from the config file.
self.activityMonitoring = Operations().getValue(
"EnableActivityMonitoring", False
"EnableActivityMonitoring", False
) or getServiceOption(self._serviceInfoDict, "EnableActivityMonitoring", False)
if self.activityMonitoring:
# The import needs to be here because of the CS must be initialized before importing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def test__getJDLParameters(mocker):
@pytest.mark.parametrize(
"mockJMInput, expected",
[
({"OK": True}, {"OK": True, "Value": "Problem Rescheduling Job"}),
(
{"OK": False, "Message": "Test"},
{"OK": True, "Value": "Problem Rescheduling Job"},
),
({"OK": True}, {"OK": True, "Value": "Problem Rescheduling Job"}),
(
{"OK": False, "Message": "Test"},
{"OK": True, "Value": "Problem Rescheduling Job"},
),
],
)
def test__rescheduleFailedJob(mocker, mockJMInput, expected):
Expand All @@ -109,22 +109,22 @@ def test__rescheduleFailedJob(mocker, mockJMInput, expected):
@pytest.mark.parametrize(
"mockGCReplyInput, mockPMReplyInput, expected",
[
(True, {"OK": True, "Value": "Test"}, {"OK": True, "Value": "Test"}),
(
True,
{"OK": False, "Message": "Test"},
{"OK": False, "Message": "Failed to setup proxy: Error retrieving proxy"},
),
(
False,
{"OK": True, "Value": "Test"},
{"OK": False, "Message": "Invalid Proxy"},
),
(
False,
{"OK": False, "Message": "Test"},
{"OK": False, "Message": "Invalid Proxy"},
),
(True, {"OK": True, "Value": "Test"}, {"OK": True, "Value": "Test"}),
(
True,
{"OK": False, "Message": "Test"},
{"OK": False, "Message": "Failed to setup proxy: Error retrieving proxy"},
),
(
False,
{"OK": True, "Value": "Test"},
{"OK": False, "Message": "Invalid Proxy"},
),
(
False,
{"OK": False, "Message": "Test"},
{"OK": False, "Message": "Invalid Proxy"},
),
],
)
def test__setupProxy(mocker, mockGCReplyInput, mockPMReplyInput, expected):
Expand Down Expand Up @@ -178,18 +178,18 @@ def test__getCPUWorkLeft(mocker):
@pytest.mark.parametrize(
"mockGCReplyInput, mockPMReplyInput, expected",
[
(True, {"OK": True, "Value": "Test"}, {"OK": True, "Value": "Test"}),
(
True,
{"OK": False, "Message": "Test"},
{"OK": False, "Message": "Error retrieving proxy"},
),
(False, {"OK": True, "Value": "Test"}, {"OK": True, "Value": "Test"}),
(
False,
{"OK": False, "Message": "Test"},
{"OK": False, "Message": "Error retrieving proxy"},
),
(True, {"OK": True, "Value": "Test"}, {"OK": True, "Value": "Test"}),
(
True,
{"OK": False, "Message": "Test"},
{"OK": False, "Message": "Error retrieving proxy"},
),
(False, {"OK": True, "Value": "Test"}, {"OK": True, "Value": "Test"}),
(
False,
{"OK": False, "Message": "Test"},
{"OK": False, "Message": "Error retrieving proxy"},
),
],
)
def test__requestProxyFromProxyManager(mocker, mockGCReplyInput, mockPMReplyInput, expected):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def __sendJobsToOptimizationMind(self, jids):
if not self.msgClient.connected:
result = self.msgClient.connect(JobManager=True)
if not result['OK']:
self.log.warn("Cannot connect to OptimizationMind!", result['Message'])
return
self.log.warn("Cannot connect to OptimizationMind!", result['Message'])
return

result = self.msgClient.createMessage("OptimizeJobs")
if not result['OK']:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
sLog = gLogger.getSubLogger(__name__)


class TornadoJobStateUpdateHandler(JobMonitoringHandlerMixin, TornadoService):
class TornadoJobMonitoringHandler(JobMonitoringHandlerMixin, TornadoService):
log = sLog
11 changes: 10 additions & 1 deletion tests/CI/install_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ then
# We ignore the Configuration for now because it is a bit special (the master needs to run in a separate process)
# system_component is a space separated System (without the word System), and Component, without the 'Handler.py'.
# For example "DataManagement TornadoFileCatalog"

if [[ "${USE_PYTHON3:-}" == "Yes" ]]; then
find "/home/dirac/LocalRepo/ALTERNATIVE_MODULES/DIRAC" -name 'Tornado*Handler.py' | grep -v Configuration | sed -e 's/Handler.py//g' -e 's/System//g'| awk -F '/' '{print $(NF-2), $NF}' > tornadoServices
cfgProdFile="${SERVERINSTALLDIR}"/diracos/etc/Production.cfg
else
find "${SERVERINSTALLDIR}"/DIRAC/ -name 'Tornado*Handler.py' | grep -v Configuration | sed -e 's/Handler.py//g' -e 's/System//g'| awk -F '/' '{print $(NF-2), $NF}' > tornadoServices
cfgProdFile="${SERVERINSTALLDIR}"/etc/Production.cfg
fi

while read -r system_component;
do
echo -e "*** $(date -u) **** Installing Tornado service ${system_component}"
Expand All @@ -99,7 +108,7 @@ then
# origin_component is the original service before Tornado (FileCatalog vs TornadoFileCatalog for example)
orig_component=$(echo "${system_component}" | sed 's/Tornado//g' | awk '{print $2}');
# Replace the dips url with the https url in the cs, assuming port 8443
sed -E "s|( +${orig_component} = )dips://([a-z]+)(:[0-9]+)(/.*/)(.*)|\1https://\2:8443\4Tornado\5|g" -i "${SERVERINSTALLDIR}"/etc/Production.cfg
sed -E "s|( +${orig_component} = )dips://([a-z]+)(:[0-9]+)(/.*/)(.*)|\1https://\2:8443\4Tornado\5|g" -i "$cfgProdFile"
dirac-restart-component Tornado Tornado -ddd
done< <(python -m DIRAC.Core.Utilities.Extensions findServices | grep Tornado | grep -v Configuration | sed -e 's/Handler//g' -e 's/System//g')

Expand Down
4 changes: 2 additions & 2 deletions tests/Jenkins/dirac_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ source "${TESTCODE}/DIRAC/tests/Jenkins/utilities.sh"
installSite() {
echo "==> [installSite]"

prepareForServer

findRelease

generateCA
Expand Down Expand Up @@ -144,6 +142,8 @@ installSite() {
done
cd -
else
prepareForServer

if [[ -n "${DEBUG+x}" ]]; then
INSTALLOPTIONS+=("${DEBUG}")
fi
Expand Down

0 comments on commit 66406bb

Please sign in to comment.