From 499f39e604b4e3e12786228de822968be8ad1d63 Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 7 Jul 2021 14:04:19 +0200 Subject: [PATCH] introduce uploadConditions.py unit test --- CondCore/Utilities/test/BuildFile.xml | 4 ++ .../Utilities/test/test_uploadConditions.sh | 57 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100755 CondCore/Utilities/test/test_uploadConditions.sh diff --git a/CondCore/Utilities/test/BuildFile.xml b/CondCore/Utilities/test/BuildFile.xml index 965967fb933c2..184523f7e7eb7 100644 --- a/CondCore/Utilities/test/BuildFile.xml +++ b/CondCore/Utilities/test/BuildFile.xml @@ -13,3 +13,7 @@ + + + + diff --git a/CondCore/Utilities/test/test_uploadConditions.sh b/CondCore/Utilities/test/test_uploadConditions.sh new file mode 100755 index 0000000000000..34fbfb70233a1 --- /dev/null +++ b/CondCore/Utilities/test/test_uploadConditions.sh @@ -0,0 +1,57 @@ +#!/bin/bash +check_for_success() { + "${@}" && echo -e "\n ---> Passed test of '${@}'\n\n" || exit 1 +} + +check_for_failure() { + "${@}" && exit 1 || echo -e "\n ---> Passed test of '${@}'\n\n" +} + +function die { echo $1: status $2; exit $2; } + +######################################## +# Test help function +######################################## +check_for_success uploadConditions.py --help + +######################################## +# Test wizard +######################################## +if test -f "BasicPayload_v0_ref.txt"; then + rm -f BasicPayload_v0_ref.txt +fi +cat <> BasicPayload_v0_ref.txt +{ + "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "destinationTags": { + "BasicPayload_v0": {} + }, + "inputTag": "BasicPayload_v0", + "since": 1, + "userText": "uploadConditions unit test" +} +EOF + +echo "Content of the directory is:" `ls -lh . | grep db` +echo -ne '\n\n' + +if test -f "BasicPayload_v0.txt"; then + rm -f BasicPayload_v0.txt +fi + +# this is expected to fail given lack of credentials +check_for_failure uploadConditions.py BasicPayload_v0.db <