From fee2cafd8af0c61893d0b0d1af38439b8cd1e6ea Mon Sep 17 00:00:00 2001 From: Dimitris Date: Wed, 13 Nov 2024 11:30:36 +0100 Subject: [PATCH] Modify DQMGUI upload test to only run in automated environments I.e., when the cmsbot is running the test for PRs or IBs, where `CMSBOT_CI_TESTS` is set. - Also fix the timestamp of the renamed file to include the hour, which was missing before, it will help with debugging. - Added a `--help` argument, just in case. See also: #46682 --- DQMServices/Demo/test/test_dqmgui_upload.sh | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/DQMServices/Demo/test/test_dqmgui_upload.sh b/DQMServices/Demo/test/test_dqmgui_upload.sh index da48f6a56bd3b..bef86bb83b492 100755 --- a/DQMServices/Demo/test/test_dqmgui_upload.sh +++ b/DQMServices/Demo/test/test_dqmgui_upload.sh @@ -7,12 +7,34 @@ set -x set -e +force=0 + +function usage(){ + echo "Usage: $0 [--help] [--force]" + exit 0 +} +# Parse args, if any. +while [[ "$#" -gt 0 ]]; do + case $1 in + --force) force=1; shift ;; + --help) usage; shift;; + *) echo "Unknown parameter passed: $1"; usage; exit 1 ;; + esac +done + +# Don't run the test unless it's run by the bot for PRs or IBs. +# The user may force it by adding --force +if [ -z "$CMSBOT_CI_TESTS" ] && [ "$force" -ne 1 ]; then + echo "Non-automated test environment, skipping test." + exit 0 +fi + DEV_DQMGUI_URL="https://cmsweb.cern.ch/dqm/dev" # Create a unique fake "Era", so that different executions of this test # produce differently named files. This is required, because this test might pass # if it's checking a file that was successfully uploaded during a previous # instance of the same test. -UNIQUE_ERA_ID=$(date -u +%Y%m%d%M%S%N) +UNIQUE_ERA_ID=$(date -u +%Y%m%d%H%M%S%N) OLD_FILENAME=DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root NEW_FILENAME=${OLD_FILENAME/DQMTests/DQMTests${UNIQUE_ERA_ID}}