forked from RedHatInsights/insights-operator-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-benchmark.sh
executable file
·38 lines (29 loc) · 921 Bytes
/
test-benchmark.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
#!/usr/bin/env bash
export DBDRIVER=$1
echo $DBDRIVER
if [[ $DBDRIVER != 'sqlite3' ]] && [[ $DBDRIVER != 'postgres' ]]
then
echo 'usage test-benchmark.sh sqlite3|postgres'
exit 1
fi
echo 'starting benchmark testing'
if [[ $DBDRIVER == 'sqlite3' ]]
then
export STORAGE='./../../test.db'
echo 'creating sqlite db'
rm ./test.db
./local_storage/create_test_database_sqlite.sh
echo 'performing tests, please wait'
go test -json -bench=. ./tests/benchmark > benchmark_test_out.json
echo 'benchmark tests completed!'
fi
if [[ $DBDRIVER == 'postgres' ]]
then
export STORAGE='postgres://postgres:postgres@localhost/test_db?sslmode=disable'
echo 'creating postgres db'
./local_storage/drop_test_database_postgres.sh
./local_storage/create_test_database_postgres.sh
echo 'performing tests, please wait'
go test -json -bench=. ./tests/benchmark > benchmark_test_out.json
echo 'benchmark tests completed!'
fi