File indexing completed on 2024-11-15 23:40:28
0001
0002
0003
0004
0005
0006
0007 set -x
0008 set -e
0009
0010 force=0
0011
0012 function usage() {
0013 echo "Usage: $0 [--help] [--force]"
0014 }
0015
0016
0017 while [[ "$#" -gt 0 ]]; do
0018 case $1 in
0019 --force)
0020 force=1
0021 shift
0022 ;;
0023 --help)
0024 usage
0025 exit 0
0026 ;;
0027 *)
0028 echo "Unknown parameter passed: $1"
0029 usage
0030 exit 1
0031 ;;
0032 esac
0033 done
0034
0035
0036
0037 if [ -z "$CMSBOT_CI_TESTS" ] && [ "$force" -ne 1 ]; then
0038 echo "Non-automated test environment, skipping test."
0039 exit 0
0040 fi
0041
0042 DEV_DQMGUI_URL="https://cmsweb.cern.ch/dqm/dev"
0043
0044
0045
0046
0047 UNIQUE_ERA_ID=$(date -u +%Y%m%d%H%M%S%N)
0048 OLD_FILENAME=DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root
0049 NEW_FILENAME=${OLD_FILENAME/DQMTests/DQMTests${UNIQUE_ERA_ID}}
0050
0051
0052 if [ ! -f $OLD_FILENAME ]; then
0053 echo "Unable to find required file ${OLD_FILENAME}!"
0054 exit 1
0055 fi
0056
0057
0058 curl_args=""
0059 if [ -n "$X509_CERT_DIR" ]; then
0060 curl_args="${curl_args} --capath ${X509_CERT_DIR}/"
0061 else
0062 curl_args="${curl_args} -k"
0063 fi
0064 if [ -n "$X509_USER_PROXY" ]; then
0065 curl_args="${curl_args} --key ${X509_USER_PROXY} --cert ${X509_USER_PROXY}"
0066 elif [ -n "$X509_USER_KEY" ] && [ -n "$X509_USER_CERT" ]; then
0067 curl_args="${curl_args} --key ${X509_USER_KEY} --cert ${X509_USER_CERT}"
0068 elif [ -f $HOME/.globus/usercert.pem ] && [ -f $HOME/.globus/userkey.pem ]; then
0069 curl_args="${curl_args} --key $HOME/.globus/userkey.pem --cert $HOME/.globus/usercert.pem"
0070 else
0071 echo "Unable to find proxy or key/cert env vars, cannot continue"
0072 exit 1
0073 fi
0074
0075
0076 rm -f "$NEW_FILENAME"
0077 cp $OLD_FILENAME "$NEW_FILENAME"
0078
0079
0080 visDQMUpload.py "$DEV_DQMGUI_URL" "$NEW_FILENAME"
0081
0082
0083
0084
0085 SECONDS_TO_WAIT=600
0086
0087 SECONDS=0
0088
0089 while true; do
0090
0091 if curl -sL $curl_args "${DEV_DQMGUI_URL}/data/json/samples?match=DQMTests${UNIQUE_ERA_ID}" | jq .samples[0].items[0].dataset | grep -q "$UNIQUE_ERA_ID"; then
0092 exit 0
0093 fi
0094
0095 sleep 10
0096
0097 if [ $SECONDS -ge $SECONDS_TO_WAIT ]; then
0098 exit 1
0099 fi
0100 done
0101 exit 1