@@ -12,6 +12,37 @@ su - postgres -c "psql -A -t -d postgres -c 'DROP DATABASE if exists ${db_name}'
12
12
su - postgres -c " psql -A -t -d postgres -c 'CREATE DATABASE ${db_name} '"
13
13
su - postgres -c " psql -A -t -d ${db_name} -f " ${current_dir} " /.ci/test_db_dump.sql"
14
14
15
+ # ---------------------------------------------------------------------------------------------
16
+ echo " =======> Test started: H002_unused_indexes.sh"
17
+ test_resut=1
18
+
19
+ rm -Rf ./artifacts
20
+ ./checkup -h 127.0.0.1 --username postgres --project test --dbname ${db_name} -e 1 \
21
+ --file ./resources/checks/H002_unused_indexes.sh
22
+
23
+ data_dir=$( cat ./artifacts/test/nodes.json | jq -r ' .last_check | .dir' ) \
24
+ && result=$( cat ./artifacts/test/json_reports/$data_dir /H002_unused_indexes.json |
25
+ jq ' .results ."127.0.0.1" .data .redundant_indexes ."public.t_with_redundant_idx_id"' ) \
26
+ && ([[ " $result " == " []" ]] || [[ " $result " == " null" ]]) \
27
+ && echo " ERROR in H002: ${result} in '.results .\" 127.0.0.1\" .data .redundant_indexes .\" public.t_with_redundant_idx_id\" '" \
28
+ && echo $( cat ./artifacts/test/json_reports/$data_dir /H002_unused_indexes.json | jq ' .' ) \
29
+ && test_resut=0
30
+
31
+ data_dir=$( cat ./artifacts/test/nodes.json | jq -r ' .last_check | .dir' ) \
32
+ && result=$( cat ./artifacts/test/json_reports/$data_dir /H002_unused_indexes.json |
33
+ jq ' .results ."127.0.0.1" .data .redundant_indexes ."public.t_with_redundant_idx_f1_uniq"' ) \
34
+ && ([[ ! " $result " == " []" ]] && [[ ! " $result " == " null" ]]) \
35
+ && echo " ERROR in H002: ${result} in '.results .\" 127.0.0.1\" .data .redundant_indexes .\" public.t_with_redundant_idx_f1_uniq\" '" \
36
+ && echo $( cat ./artifacts/test/json_reports/$data_dir /H002_unused_indexes.json | jq ' .' ) \
37
+ && test_resut=0
38
+
39
+ if [ " $test_resut " -eq " 1" ]; then
40
+ echo " <======= Test finished: H002"
41
+ else
42
+ echo " <======= Test failed: H002"
43
+ fi
44
+
45
+ # ---------------------------------------------------------------------------------------------
15
46
echo " =======> Test started: H003 Non indexed FKs"
16
47
test_resut=1
17
48
su - postgres -c " psql -A -t -d ${db_name} -f " ${current_dir} " /.ci/h003_step_1.sql"
@@ -47,3 +78,4 @@ if [ "$test_resut" -eq "1" ]; then
47
78
else
48
79
echo " <======= Test failed: H003"
49
80
fi
81
+ # ---------------------------------------------------------------------------------------------
0 commit comments