Skip to content

Commit

Permalink
Merge pull request #1546 from arooshap/cric_aps_changes
Browse files Browse the repository at this point in the history
Script to test APS endpoints.
  • Loading branch information
arooshap authored Sep 10, 2024
2 parents e1a1756 + e4dc3fa commit 2d67aea
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
72 changes: 72 additions & 0 deletions kubernetes/cmsweb/scripts/test_k8s_aps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
##H Usage: test_k8s_aps.sh <base_url> <url_list_file>
##H

if [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ] || [ "$1" == "help" ] || [ "$1" == "" ]; then
grep "##H" $0 | sed -e "s,##H,,g"
exit 1
fi

# Check if required arguments are provided
if [ $# -ne 2 ]; then
echo "Error: You need to provide <base_url> and <url_list_file>"
grep "##H" $0 | sed -e "s,##H,,g"
exit 1
fi

X509_USER_KEY=$HOME/.globus/userkey.pem
X509_USER_CERT=$HOME/.globus/usercert.pem

base_url=$1
url_list_file=$2

# Check if the URL list file exists
if [ ! -f "$url_list_file" ]; then
echo "Error: File $url_list_file not found!"
exit 1
fi

# Function to perform the request with automatic redirect following
perform_request() {
local target_url="$1"
local cert="$2"
local key="$3"
final_status_code=$(curl -L -i --key "$key" --cert "$cert" -o /dev/null -w '%{http_code}' -s "$target_url")
echo " $target_url -> HTTP code: $final_status_code"
}

# Read the list of URLs from the file and process each
run_tests() {
local cert="$1"
local key="$2"
current_section=""
while read -r line; do
# If the line is a comment, treat it as a section heading
if [[ "$line" =~ ^#.*$ ]]; then
section_header="${line/#\# /}" # Remove "# " from the start of the comment
if [[ "$section_header" != "$current_section" ]]; then
current_section="$section_header"
echo
echo "== $current_section =="
fi
# If the line is not empty or a comment, process the URL
elif [[ ! -z "$line" ]]; then
perform_request "${base_url}${line}" "$cert" "$key"
fi
done < "$url_list_file"
}

# Run tests with X509_USER_CERT and X509_USER_KEY
echo "### Running tests with X509_USER_CERT and X509_USER_KEY"
run_tests "$X509_USER_CERT" "$X509_USER_KEY"

# Generate and use the proxy certificate
echo "### Running tests with X509_USER_PROXY"
unset X509_USER_PROXY
voms-proxy-init -voms cms -rfc
export X509_USER_PROXY=/tmp/x509up_u`id -u`

echo
echo "### Testing with proxy: $X509_USER_PROXY"
run_tests "$X509_USER_PROXY" "$X509_USER_PROXY"

49 changes: 49 additions & 0 deletions kubernetes/cmsweb/scripts/urls.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# CouchDB
/couchdb/

# Crabserver
/crabserver/preprod/info
/scheddmon/059/crabint1/

# DAS
/das

# DBS
/dbs/int/global/DBSReader/serverinfo
/dbs/int/global/DBSReader/datasets?dataset=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM&dataset_access_type=%2A&detail=False
/dbs/int/global/DBSReader/blocks?dataset=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM&detail=False
/dbs/int/global/DBSReader/blocks?block_name=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM%23f6557ea8-2493-4644-90a2-8a2fbb070abc

# DMWM
/acdcserver/_all_docs
/reqmgr2/data/info
/workqueue/index.html
/t0_reqmon/data/info
/wmstatsserver/data/info
/wmstats/index.html
/exitcodes
/wmarchive/data
/ms-transferor/data/status
/ms-monitor/data/status
/ms-output/data/status
/ms-rulecleaner/data/status
/ms-unmerged/data/status?rse_type=t1
/ms-unmerged/data/status?rse_type=t2t3
/ms-unmerged/data/status?rse_type=t2t3us

# DQM
/dqm/dqm-square/
/dqm/online/
/dqm/online-playback/
/dqm/offline/
/dqm/relval/
/dqm/dev/
/dqm/offline-test/
/dqm/relval-test/

# T0
/t0wmadatasvc/prod/firstconditionsaferun
/t0wmadatasvc/prod/config
/t0wmadatasvc/prod/express_config
/t0wmadatasvc/prod/reco_config

0 comments on commit 2d67aea

Please sign in to comment.