Skip to content

Commit

Permalink
test: Use dedicated script to set up DiracX in the CS
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Oct 30, 2023
1 parent 0d72a7d commit 9b0cadf
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
36 changes: 36 additions & 0 deletions tests/Jenkins/dirac-cfg-setup-diracx.py
Original file line number Diff line number Diff line change
@@ -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()
11 changes: 9 additions & 2 deletions tests/Jenkins/dirac_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/Jenkins/utilities.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b0cadf

Please sign in to comment.