chore: move WSL2 test scripts to scripts directory
For consistency with other shell scripts in the codebase. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
66
scripts/test_issue_gh1224.sh
Executable file
66
scripts/test_issue_gh1224.sh
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
# Integration test for GH#1224 - SQLite WAL mode on WSL2 Docker bind mounts
|
||||
# This test verifies that bd properly handles database creation on problematic paths
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== Testing GH#1224 Fix: SQLite WAL on WSL2 Docker Bind Mounts ==="
|
||||
|
||||
# Check if we're in WSL2
|
||||
if ! grep -qi microsoft /proc/version; then
|
||||
echo "Not running in WSL2, skipping integration test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create test directories in different locations
|
||||
tmpdir=$(mktemp -d)
|
||||
cleanup() {
|
||||
rm -rf "$tmpdir"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# Test 1: Native WSL2 filesystem (should use WAL mode)
|
||||
echo ""
|
||||
echo "Test 1: Native WSL2 filesystem (/tmp)"
|
||||
native_test_dir="$tmpdir/native_test"
|
||||
mkdir -p "$native_test_dir"
|
||||
cd "$native_test_dir"
|
||||
git init > /dev/null 2>&1 || true
|
||||
bd init -q > /dev/null 2>&1 || echo "Note: bd init may fail in test env, but database setup is what matters"
|
||||
if [ -f ".beads/beads.db" ]; then
|
||||
echo "✓ Database created successfully in native filesystem"
|
||||
else
|
||||
echo "✗ Failed to create database in native filesystem"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 2: Windows filesystem path (if /mnt/c exists) - should use DELETE mode
|
||||
if [ -d "/mnt/c" ]; then
|
||||
echo ""
|
||||
echo "Test 2: Windows filesystem (/mnt/c)"
|
||||
# Note: We can't actually create a git repo in Windows filesystem from WSL2 easily,
|
||||
# but the fix ensures WAL mode is disabled for these paths
|
||||
echo "✓ Windows path detection enabled (WAL mode disabled)"
|
||||
fi
|
||||
|
||||
# Test 3: Docker Desktop bind mount detection (if /mnt/wsl exists) - should use DELETE mode
|
||||
if [ -d "/mnt/wsl" ]; then
|
||||
echo ""
|
||||
echo "Test 3: Docker Desktop bind mount (/mnt/wsl)"
|
||||
docker_test_dir="/mnt/wsl/beads-test-integration-$$"
|
||||
if mkdir -p "$docker_test_dir" 2>/dev/null; then
|
||||
cd "$docker_test_dir"
|
||||
git init > /dev/null 2>&1 || true
|
||||
# Try to use bd on this path
|
||||
if bd version > /dev/null 2>&1; then
|
||||
echo "✓ Docker bind mount path handled correctly (WAL mode disabled)"
|
||||
else
|
||||
echo "Note: bd version check may fail in test env"
|
||||
fi
|
||||
cd /
|
||||
rm -rf "$docker_test_dir" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Integration test complete ==="
|
||||
Reference in New Issue
Block a user