fix(ci): Fix integration test failures and installer container detection

Fixes three CI failures identified in workflow run #19395416465:

1. **Missing threading import** (test_peripheral_disconnect_cleanup.py)
   - Added missing `import threading` to fix NameError during test setup
   - Tests use threading.RLock() but import was missing

2. **Timing race condition** (test_stale_connection_polling.py)
   - Increased sleep from 0.15s to 1.5s in test_polling_interval_30_seconds
   - Test expects 2 polling cycles at 0.6s each, was timing out in CI

3. **Container-aware Bluetooth checks** (install.sh)
   - Added is_container() helper to detect Docker/container environments
   - Skip Bluetooth adapter power checks in containers (no hardware access)
   - Prevents false failures from bluetoothctl crashes in CI environments

All changes are test/installer infrastructure only - no production code changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
torlando-tech 2025-11-15 20:05:17 -05:00
commit e9f20c27a8
3 changed files with 23 additions and 3 deletions

View file

@ -35,6 +35,19 @@ print_info() {
echo -e "${BLUE}${NC} $1"
}
# Helper function: Detect if running in a container environment
is_container() {
# Check for Docker container
if [ -f /.dockerenv ]; then
return 0
fi
# Check cgroup for container indicators
if grep -q -E 'docker|lxc|containerd|kubepods' /proc/1/cgroup 2>/dev/null; then
return 0
fi
return 1
}
# Helper function: pip install with compatibility across all OS versions
pip_install() {
local packages="$*"
@ -680,7 +693,13 @@ fi
# Step 5B: Bluetooth Adapter Power State
print_header "Bluetooth Adapter Power State"
if command -v bluetoothctl &> /dev/null; then
# Skip Bluetooth checks in container environments (no hardware access)
if is_container; then
print_info "Container environment detected - skipping Bluetooth adapter checks"
print_warning "Bluetooth hardware is not available in containers"
print_info "This is expected behavior for CI/testing environments"
echo
elif command -v bluetoothctl &> /dev/null; then
print_info "Checking Bluetooth adapter power state..."
# Check for rfkill blocks first (must be unblocked before power-on works)