Skip to content

Commit

Permalink
introduce uploadConditions unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed Jul 7, 2021
1 parent 0fe0540 commit d2028fb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CondCore/Utilities/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@
</bin>

<test name="testGetPayloadData" command="test_getPayloadData.sh"/>

<bin name="test_uploadConditions" file="testDriver.cpp">
<flags TEST_RUNNER_ARGS="/bin/bash CondCore/Utilities/test/ test_uploadConditions.sh"/>
<flags PRE_TEST="testBasicPayload"/>
<use name="FWCore/Utilities"/>
</bin>
2 changes: 2 additions & 0 deletions CondCore/Utilities/test/testDriver.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "FWCore/Utilities/interface/TestHelper.h"
RUNTEST()
35 changes: 35 additions & 0 deletions CondCore/Utilities/test/test_uploadConditions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/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"
}

########################################
# Test help function
########################################
check_for_success uploadConditions.py --help

########################################
# Test wizard
########################################
if test -f "BasicPayload_v0.txt"; then
rm -f BasicPayload_v0.txt
fi
cat <<EOF >> BasicPayload_v0.txt
{
"destinationDatabase": "ANYTHIGHEREWILLDO",
"destinationTags": {
"BasicPayload_v0": {}
},
"inputTag": "BasicPayload_v0",
"since": null,
"userText": "test wizard"
}
EOF

echo "content of the directory is:" `ls -lh . | grep db`
check_for_failure uploadConditions.py BasicPayload_v0.db

0 comments on commit d2028fb

Please sign in to comment.