fix(tests): update run-tests.sh for better output
This commit is contained in:
parent
812b2067c2
commit
02fbe3847b
27
run-tests.sh
27
run-tests.sh
|
|
@ -205,18 +205,27 @@ run_unit_tests() {
|
||||||
run_integration_tests() {
|
run_integration_tests() {
|
||||||
print_status "Running integration tests..."
|
print_status "Running integration tests..."
|
||||||
|
|
||||||
# Run integration tests locally with test database URL and API URL
|
# Create a temporary file for output
|
||||||
local output
|
local output_file=$(mktemp)
|
||||||
local exit_code
|
local exit_code
|
||||||
|
|
||||||
output=$(DATABASE_URL="postgresql://readur_test:readur_test@localhost:5433/readur_test" \
|
# Run integration tests with real-time output
|
||||||
TEST_DATABASE_URL="postgresql://readur_test:readur_test@localhost:5433/readur_test" \
|
print_status "Starting cargo test... (streaming output)"
|
||||||
API_URL="http://localhost:8001" \
|
echo ""
|
||||||
cargo test --test '*' --no-fail-fast 2>&1)
|
|
||||||
exit_code=$?
|
|
||||||
|
|
||||||
# Display output in terminal
|
# Run tests and show output in real-time while also saving to file
|
||||||
echo "$output"
|
DATABASE_URL="postgresql://readur_test:readur_test@localhost:5433/readur_test" \
|
||||||
|
TEST_DATABASE_URL="postgresql://readur_test:readur_test@localhost:5433/readur_test" \
|
||||||
|
API_URL="http://localhost:8001" \
|
||||||
|
cargo test --test '*' --no-fail-fast 2>&1 | tee "$output_file"
|
||||||
|
|
||||||
|
exit_code=${PIPESTATUS[0]}
|
||||||
|
|
||||||
|
# Read the full output for saving
|
||||||
|
local output=$(cat "$output_file")
|
||||||
|
rm -f "$output_file"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
if [ $exit_code -eq 0 ]; then
|
if [ $exit_code -eq 0 ]; then
|
||||||
print_success "Integration tests passed"
|
print_success "Integration tests passed"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue