-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathtest_uploadConditions.sh
executable file
·57 lines (49 loc) · 1.39 KB
/
test_uploadConditions.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 <<EOF >> 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 <<EOF
y
0
oracle://cms_orcoff_prep/CMS_CONDITIONS
1
uploadConditions unit test
BasicPayload_v0
`echo -ne '\n'`
y
test
test
EOF
# test that the metadata created with the wizard corresponds to the reference one
diff -w BasicPayload_v0.txt BasicPayload_v0_ref.txt || die 'failed comparing metadata with reference' $?