Add 'ops/' directory and sqlite_lint integration test
All checks were successful
CI / release-test (push) Successful in 24s
All checks were successful
CI / release-test (push) Successful in 24s
This commit is contained in:
47
ops/sqlite_lint_test.sh
Executable file
47
ops/sqlite_lint_test.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ------------------
|
||||
# This is a test script that checks that `sqlite_lint` subcommand works as expected.
|
||||
# ------------------
|
||||
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
PS4='+(${BASH_SOURCE}:${LINENO}): '
|
||||
cd "$(dirname ${BASH_SOURCE[0]})/.."
|
||||
|
||||
# Compile `gas`
|
||||
program="/tmp/gas"
|
||||
go build -o $program ./cmd
|
||||
|
||||
test_schema_dir="pkg/schema/lint/test_schemas"
|
||||
|
||||
# Check all failure cases
|
||||
for test_schema in $test_schema_dir/failure-*; do
|
||||
output=$($program sqlite_lint $test_schema) && {
|
||||
echo "Expected test to fail"
|
||||
exit 9
|
||||
}
|
||||
|
||||
# Should print the name of the file being linted
|
||||
if ! echo "$output" | grep -Fxq "Linting $test_schema"; then
|
||||
echo "Expected 'Linting $test_schema' in output"
|
||||
exit 10
|
||||
fi
|
||||
done
|
||||
|
||||
# Check success case
|
||||
success_schema="$test_schema_dir/success.sql"
|
||||
output=$($program sqlite_lint $success_schema) || {
|
||||
echo "Expected test to succeed"
|
||||
exit 9
|
||||
}
|
||||
# Should print the name of the file being linted
|
||||
if ! echo "$output" | grep -Fxq "Linting $success_schema"; then
|
||||
echo "Expected 'Linting $success_schema' in output"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
# Notify success in green
|
||||
echo -e "\033[32mAll tests passed. Finished successfully.\033[0m"
|
||||
Reference in New Issue
Block a user