diff --git a/tests/Jenkins/dirac-cfg-setup-diracx.py b/tests/Jenkins/dirac-cfg-setup-diracx.py new file mode 100755 index 00000000000..5019dd5fa34 --- /dev/null +++ b/tests/Jenkins/dirac-cfg-setup-diracx.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +import argparse + +import DIRAC +from DIRAC.Core.Utilities.ReturnValues import returnValueOrRaise + + +def parse_args(): + parser = argparse.ArgumentParser(description="Setup DIRAC CS for running integration tests with DiracX") + parser.add_argument("--disable-vo", nargs="+", help="Disable a VO", default=[]) + parser.add_argument("--url", help="URL of the DiracX services") + args = parser.parse_args() + + DIRAC.initialize() + + main(args.url, args.disable_vo) + + +def main(url: str, disabled_vos: list[str]): + from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI + + csAPI = CSAPI() + + returnValueOrRaise(csAPI.createSection("DiracX")) + + if url: + returnValueOrRaise(csAPI.setOption("DiracX/URL", url)) + + if disabled_vos: + returnValueOrRaise(csAPI.setOption("DiracX/DisabledVOs", ",".join(disabled_vos))) + + returnValueOrRaise(csAPI.commit()) + + +if __name__ == "__main__": + parse_args() diff --git a/tests/Jenkins/dirac_ci.sh b/tests/Jenkins/dirac_ci.sh index 2e8f5957738..ad6c70c70fa 100644 --- a/tests/Jenkins/dirac_ci.sh +++ b/tests/Jenkins/dirac_ci.sh @@ -136,15 +136,22 @@ installSite() { echo "==> Done installing, now configuring" source "${SERVERINSTALLDIR}/bashrc" configureArgs=() - if [[ -n "${TEST_DIRACX:-}" ]]; then + if [[ "${TEST_DIRACX:-}" = "Yes" ]]; then configureArgs+=("--LegacyExchangeApiKey=diracx:legacy:InsecureChangeMe") - configureArgs+=("--DiracxUrl=${DIRACX_URL}") fi if ! dirac-configure --cfg "${SERVERINSTALLDIR}/install.cfg" "${configureArgs[@]}" "${DEBUG}"; then echo "ERROR: dirac-configure failed" >&2 exit 1 fi + echo "==> Setting up DiracX" + if [[ "${TEST_DIRACX:-}" = "Yes" ]]; then + diracxSetupArgs+=("--url=${DIRACX_URL}") + else + diracxSetupArgs+=("--disable-vo" "vo") + fi + python "${TESTCODE}/DIRAC/tests/Jenkins/dirac-cfg-setup-diracx.py" "${DEBUG}" + if ! dirac-setup-site "${DEBUG}"; then echo "ERROR: dirac-setup-site failed" >&2 exit 1 diff --git a/tests/Jenkins/utilities.sh b/tests/Jenkins/utilities.sh index e38b548ec4d..1e5b2cb36c1 100644 --- a/tests/Jenkins/utilities.sh +++ b/tests/Jenkins/utilities.sh @@ -614,7 +614,7 @@ diracProxies() { # And make sure it was synced if [[ -n $TEST_DIRACX ]]; then echo "Waiting for for DiracX to be available" >&2 - for i in {1..100}; do + for i in {1..10}; do if dirac-login -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" -T 72 "${DEBUG}"; then break fi