Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit b20c737

Browse files
authored
Merge branch 'master' into rework
2 parents c2cbb78 + 28acb2f commit b20c737

File tree

3 files changed

+49
-26
lines changed

3 files changed

+49
-26
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.circleci/tmp
2-
./*.json
3-
./*.gz
2+
docker/tmp
3+
*.gz
4+
*.json

nancy

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,41 @@ case "$1" in
88
echo -e "
99
\033[1mDESCRIPTION\033[22m
1010
11-
The Nancy Command Line Interface is a unified way to manage
12-
database experiments.
11+
The Nancy Command Line Interface is a unified way to manage database
12+
experiments.
1313
14-
Nancy is a member of Postgres.ai's Artificial DBA team
15-
responsible for conducting experiments.
14+
Nancy is a member of Postgres.ai's Artificial DBA team responsible for
15+
conducting experiments.
1616
1717
\033[1mSYNOPSYS\033[22m
1818
19-
nancy <command> [parameters]
19+
nancy <command> [parameters]
2020
2121
\033[1mAVAILABLE COMMANDS\033[22m
2222
2323
* help
2424
25-
* prepare-database
25+
* prepare-database (WIP)
2626
2727
* prepare-workload
2828
2929
* run
30-
" | less -RFX
31-
exit 1;
32-
;;
33-
* )
34-
word="${1/-/_}"
35-
if [ ! -f "${BASH_SOURCE%/*}/nancy_$word.sh" ]
36-
then
37-
>&2 echo "ERROR: Unknown command."
38-
>&2 echo "Try 'nancy help'"
39-
exit 1;
40-
fi
41-
cmd="${BASH_SOURCE%/*}/nancy_$word.sh"
42-
shift;
43-
;;
30+
" | less -RFX
31+
exit 1;
32+
;;
33+
* )
34+
word="${1/-/_}"
35+
if [[ ! -f "${BASH_SOURCE%/*}/nancy_$word.sh" ]]; then
36+
>&2 echo "ERROR: Unknown command: $word."
37+
>&2 echo "Try 'nancy help'"
38+
exit 1
39+
fi
40+
cmd="${BASH_SOURCE%/*}/nancy_$word.sh"
41+
shift;
42+
;;
4443
esac
4544

46-
while [ -n "$1" ]
47-
do
45+
while [ -n "$1" ]; do
4846
if [ "$1" == "--debug" ]; then
4947
DEBUG=1
5048
fi
@@ -56,6 +54,6 @@ do
5654
shift
5755
done
5856

59-
[ "$DEBUG" -eq "1" ] && echo "CMD: $cmd"
57+
[[ "$DEBUG" -eq "1" ]] && echo "CMD: $cmd"
6058

61-
eval $cmd
59+
eval "$cmd"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
realpath() {
4+
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
5+
}
6+
7+
src_dir=$(dirname $(dirname $(realpath "$0")))"/.circleci"
8+
9+
output=$(
10+
${BASH_SOURCE%/*}/../nancy run \
11+
--db-dump "create table t1 as select * from generate_series(1, 1000);" \
12+
--workload-custom-sql "select count(*) from t1;" \
13+
--tmp-path $src_dir/tmp 2>&1
14+
)
15+
16+
regex="Errors:[[:blank:]]*0"
17+
if [[ $output =~ $regex ]]; then
18+
echo -e "\e[36mOK\e[39m"
19+
else
20+
>&2 echo -e "\e[31mFAILED\e[39m"
21+
>&2 echo -e "Output: $output"
22+
exit 1
23+
fi
24+

0 commit comments

Comments
 (0)