This repository has been archived by the owner on Nov 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
74 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
count=$(PGPASSWORD=postgres psql -h lantern -U postgres -t -A -c "SELECT COUNT(*) FROM pg_available_extensions WHERE name IN ('lantern', 'lantern_extras', 'pg_cron', 'pg_stat_statements', 'vector');") | ||
echo "Count: $count" | ||
if echo "$count" | grep -q "ERROR"; then | ||
echo "Failed to retrieve extension count" && exit 1 | ||
elif [ "$count" -ne 5 ]; then | ||
echo "Extension check failed" && exit 1 | ||
#!/bin/bash | ||
|
||
available_extensions=$(PGPASSWORD=postgres psql -h lantern -U postgres -t -A -c "SELECT name FROM pg_available_extensions WHERE name IN ('lantern', 'lantern_extras', 'pg_cron', 'pg_stat_statements', 'vector');") | ||
|
||
required_extensions=("lantern" "lantern_extras" "pg_cron" "pg_stat_statements" "vector") | ||
missing_extensions=() | ||
for ext in "${required_extensions[@]}"; do | ||
if ! echo "$available_extensions" | grep -q "^${ext}$"; then | ||
missing_extensions+=("$ext") | ||
fi | ||
done | ||
|
||
if [ ${#missing_extensions[@]} -ne 0 ]; then | ||
echo "Extension check failed. Missing extensions: ${missing_extensions[*]}" | ||
exit 1 | ||
else | ||
echo "Extension check passed" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Function to run a test and check its result | ||
run_test() { | ||
local test_name="$1" | ||
local test_command="$2" | ||
|
||
echo "Running $test_name..." | ||
if $test_command; then | ||
echo "$test_name PASSED" | ||
else | ||
echo "$test_name FAILED" | ||
return 1 | ||
fi | ||
} | ||
|
||
# Initialize a variable to track overall test success | ||
overall_success=true | ||
|
||
# Test 1: Check PostgreSQL extension count | ||
run_test "Check PostgreSQL extension count" ./test/extension-count.sh || overall_success=false | ||
|
||
# Test 2: Check for .so files presence | ||
run_test "Check .so files presence" ./test/so-files-present.sh || overall_success=false | ||
|
||
# Exit with an error if any test failed | ||
if [ "$overall_success" = false ]; then | ||
echo "One or more tests failed." | ||
exit 1 | ||
else | ||
echo "All tests passed successfully." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
PG_VERSION=15 | ||
|
||
declare -a extensions=("lantern" "lantern_extras" "pg_cron" "pg_stat_statements" "vector") | ||
|
||
missing_files=() | ||
for ext in "${extensions[@]}"; do | ||
if ! [ -f "/usr/lib/postgresql/$PG_VERSION/lib/${ext}.so" ]; then | ||
missing_files+=("/usr/lib/postgresql/$PG_VERSION/lib/${ext}.so") | ||
fi | ||
done | ||
|
||
if [ ${#missing_files[@]} -ne 0 ]; then | ||
echo "Shared object files missing for the following extensions:" | ||
for file in "${missing_files[@]}"; do | ||
echo "$file" | ||
done | ||
exit 1 | ||
else | ||
echo "All necessary shared object files are present" | ||
fi |