Skip to content

Commit e18eb7c

Browse files
committed
test: Use dedicated script to set up DiracX in the CS
1 parent 0d72a7d commit e18eb7c

File tree

3 files changed

+57
-3
lines changed

3 files changed

+57
-3
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python
2+
import argparse
3+
import os
4+
5+
import DIRAC
6+
from DIRAC.Core.Utilities.ReturnValues import returnValueOrRaise
7+
8+
9+
def parse_args():
10+
parser = argparse.ArgumentParser(description="Setup DIRAC CS for running integration tests with DiracX")
11+
parser.add_argument("--disable-vo", nargs="+", help="Disable a VO", default=[])
12+
parser.add_argument("--url", help="URL of the DiracX services")
13+
parser.add_argument("--credentials-dir", help="Directory where hostcert.pem/hostkey.pem can be found")
14+
args = parser.parse_args()
15+
16+
DIRAC.initialize(
17+
host_credentials=(
18+
f"{args.credentials_dir}/hostcert.pem",
19+
f"{args.credentials_dir}/hostkey.pem",
20+
)
21+
)
22+
23+
main(args.url, args.disable_vo)
24+
25+
26+
def main(url: str, disabled_vos: list[str]):
27+
from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI
28+
29+
csAPI = CSAPI()
30+
31+
returnValueOrRaise(csAPI.createSection("DiracX"))
32+
33+
if url:
34+
returnValueOrRaise(csAPI.setOption("DiracX/URL", url))
35+
36+
if disabled_vos:
37+
returnValueOrRaise(csAPI.setOption("DiracX/DisabledVOs", ",".join(disabled_vos)))
38+
39+
returnValueOrRaise(csAPI.commit())
40+
41+
42+
if __name__ == "__main__":
43+
parse_args()

tests/Jenkins/dirac_ci.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ installSite() {
136136
echo "==> Done installing, now configuring"
137137
source "${SERVERINSTALLDIR}/bashrc"
138138
configureArgs=()
139-
if [[ -n "${TEST_DIRACX:-}" ]]; then
139+
if [[ "${TEST_DIRACX:-}" = "Yes" ]]; then
140140
configureArgs+=("--LegacyExchangeApiKey=diracx:legacy:InsecureChangeMe")
141-
configureArgs+=("--DiracxUrl=${DIRACX_URL}")
142141
fi
143142
if ! dirac-configure --cfg "${SERVERINSTALLDIR}/install.cfg" "${configureArgs[@]}" "${DEBUG}"; then
144143
echo "ERROR: dirac-configure failed" >&2
@@ -150,6 +149,18 @@ installSite() {
150149
exit 1
151150
fi
152151

152+
echo "==> Setting up DiracX"
153+
diracxSetupArgs=("--credentials-dir" "$SERVERINSTALLDIR/etc/grid-security")
154+
if [[ "${TEST_DIRACX:-}" = "Yes" ]]; then
155+
diracxSetupArgs+=("--url=${DIRACX_URL}")
156+
else
157+
diracxSetupArgs+=("--disable-vo" "vo")
158+
fi
159+
if ! python "${TESTCODE}/DIRAC/tests/Jenkins/dirac-cfg-setup-diracx.py" "${diracxSetupArgs[@]}"; then
160+
echo "ERROR: dirac-cfg-setup-diracx.py failed" >&2
161+
exit 1
162+
fi
163+
153164
echo "==> Completed installation"
154165

155166
}

tests/Jenkins/utilities.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ diracProxies() {
614614
# And make sure it was synced
615615
if [[ -n $TEST_DIRACX ]]; then
616616
echo "Waiting for for DiracX to be available" >&2
617-
for i in {1..100}; do
617+
for i in {1..10}; do
618618
if dirac-login -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" -T 72 "${DEBUG}"; then
619619
break
620620
fi

0 commit comments

Comments
 (0)