Skip to content

Commit a95af8d

Browse files
author
Herambh Shah
committed
testing first time valgrind github workflow
1 parent ee8f7b7 commit a95af8d

24 files changed

+266
-2806
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: 'Run JDBC Tests'
2+
description: 'Run Babel JDBC test framework'
3+
4+
inputs:
5+
input_dir:
6+
description: 'Test input directory'
7+
required: false
8+
default: input
9+
migration_mode:
10+
description: 'Database migration mode'
11+
required: false
12+
default: "multi-db"
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Run JDBC Tests
18+
run: |
19+
export PATH=~/${{env.INSTALL_DIR}}/bin:$PATH
20+
export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish
21+
export inputFilesPath=${{inputs.input_dir}}
22+
cd test/JDBC/
23+
24+
# Create a temporary file to store selected tests
25+
> temp_selected_tests
26+
27+
# Function to check if test is ignored
28+
is_test_ignored() {
29+
local test_name=$1
30+
grep -q "^ignore#!#$test_name$" jdbc_schedule 2>/dev/null
31+
return $?
32+
}
33+
34+
# Find all SQL test files from input directory and its subdirectories
35+
SQL_TESTS=$(find input -name "*.sql")
36+
37+
# Function to get base name of VU test
38+
get_vu_base_name() {
39+
local file_name=$1
40+
if [[ $file_name == *"-vu-prepare"* ]]; then
41+
echo "${file_name%-vu-prepare*}"
42+
elif [[ $file_name == *"-vu-verify"* ]]; then
43+
echo "${file_name%-vu-verify*}"
44+
elif [[ $file_name == *"-vu-cleanup"* ]]; then
45+
echo "${file_name%-vu-cleanup*}"
46+
else
47+
echo "$file_name"
48+
fi
49+
}
50+
51+
# Randomly select 3 test files
52+
echo "$SQL_TESTS" | shuf -n 3 | while read -r test; do
53+
# Get the base name without extension
54+
test_without_ext=$(basename "$test" .sql)
55+
56+
# Skip if test is marked as ignored
57+
if is_test_ignored "$test_without_ext"; then
58+
echo "Skipping ignored test: $test_without_ext"
59+
continue
60+
fi
61+
62+
# Check if it's a VU test by looking for -vu- in the name
63+
if [[ $test_without_ext == *"-vu-"* ]]; then
64+
# Extract the base name (everything before -vu-)
65+
base_name=${test_without_ext%%-vu-*}
66+
67+
# Add all three related files in order
68+
echo "${base_name}-vu-prepare" >> temp_selected_tests
69+
echo "${base_name}-vu-verify" >> temp_selected_tests
70+
echo "${base_name}-vu-cleanup" >> temp_selected_tests
71+
echo "Added VU test suite: $base_name"
72+
else
73+
# This is a normal test
74+
echo "$test_without_ext" >> temp_selected_tests
75+
echo "Added normal test: $test_without_ext"
76+
fi
77+
done
78+
79+
# Clear the schedule file and write the new tests
80+
> jdbc_schedule
81+
82+
# Remove duplicates while maintaining order
83+
awk '!seen[$0]++' temp_selected_tests > jdbc_schedule
84+
rm temp_selected_tests
85+
86+
echo "Schedule file contents:"
87+
cat jdbc_schedule
88+
89+
# Update migration mode
90+
if [[ '${{ inputs.migration_mode }}' == 'single-db' ]];then
91+
export isSingleDbMode=true
92+
fi
93+
94+
# Run the tests
95+
mvn -B -ntp test
96+
97+
if [[ '${{ inputs.migration_mode }}' == 'single-db' ]];then
98+
unset isSingleDbMode
99+
fi
100+
101+
echo "Completed running the tests from schedule:"
102+
103+
shell: bash

.github/workflows/code-coverage.yml

Lines changed: 0 additions & 177 deletions
This file was deleted.

.github/workflows/dotnet-tests.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)