Isolate E2E tests from real tmux sessions #193

Closed
opened 2026-02-04 08:27:49 +00:00 by mprihoda · 1 comment
mprihoda commented 2026-02-04 08:27:49 +00:00 (Migrated from github.com)

Problem

Running E2E tests currently spawns real tmux sessions and can detach or interfere with actual work sessions. This creates several issues:

  1. Test pollution: Tests create real tmux sessions that persist after test completion
  2. Session interference: Tests may detach from or switch between real user sessions
  3. Non-deterministic failures: Tests may fail or behave unpredictably if user has existing tmux sessions
  4. Dangerous side effects: Running tests could disrupt actual development work

Expected Behavior

E2E tests should:

  • Run in complete isolation from real tmux sessions
  • Clean up all test sessions after completion
  • Not interfere with user's actual tmux sessions
  • Be safe to run at any time without disrupting work

Possible Solutions

  1. Mock tmux adapter in tests

    • Create a test double that simulates tmux behavior
    • No real sessions created
    • Fastest option but may miss real integration issues
  2. Use custom tmux socket

    • Create tests with tmux -L test-socket-name
    • Completely separate from default tmux server
    • Tests run against isolated tmux instance
    • Clean up socket after tests
  3. Test in container/sandbox

    • Run E2E tests in Docker container or isolated environment
    • Most realistic but adds complexity
  4. Session naming prefix + cleanup

    • All test sessions prefixed with iw-test-
    • Aggressive cleanup in test teardown and setup
    • Still risks interference if not careful

Custom tmux socket (#2) seems like the best balance:

  • Real tmux integration (catches actual bugs)
  • Complete isolation from user sessions
  • Relatively simple implementation
  • Can be combined with cleanup hooks

Acceptance Criteria

  • E2E tests use isolated tmux instance (or mocking)
  • Tests cannot see or interact with real user tmux sessions
  • All test sessions cleaned up after test run
  • Tests pass reliably regardless of user's tmux state
  • Documentation updated with testing approach

Additional Context

This issue should be addressed before implementing CI automation (#191), since CI will run these tests on every commit.

## Problem Running E2E tests currently spawns real tmux sessions and can detach or interfere with actual work sessions. This creates several issues: 1. **Test pollution**: Tests create real tmux sessions that persist after test completion 2. **Session interference**: Tests may detach from or switch between real user sessions 3. **Non-deterministic failures**: Tests may fail or behave unpredictably if user has existing tmux sessions 4. **Dangerous side effects**: Running tests could disrupt actual development work ## Expected Behavior E2E tests should: - Run in complete isolation from real tmux sessions - Clean up all test sessions after completion - Not interfere with user's actual tmux sessions - Be safe to run at any time without disrupting work ## Possible Solutions 1. **Mock tmux adapter in tests** - Create a test double that simulates tmux behavior - No real sessions created - Fastest option but may miss real integration issues 2. **Use custom tmux socket** - Create tests with `tmux -L test-socket-name` - Completely separate from default tmux server - Tests run against isolated tmux instance - Clean up socket after tests 3. **Test in container/sandbox** - Run E2E tests in Docker container or isolated environment - Most realistic but adds complexity 4. **Session naming prefix + cleanup** - All test sessions prefixed with `iw-test-` - Aggressive cleanup in test teardown and setup - Still risks interference if not careful ## Recommended Approach Custom tmux socket (#2) seems like the best balance: - Real tmux integration (catches actual bugs) - Complete isolation from user sessions - Relatively simple implementation - Can be combined with cleanup hooks ## Acceptance Criteria - [ ] E2E tests use isolated tmux instance (or mocking) - [ ] Tests cannot see or interact with real user tmux sessions - [ ] All test sessions cleaned up after test run - [ ] Tests pass reliably regardless of user's tmux state - [ ] Documentation updated with testing approach ## Additional Context This issue should be addressed before implementing CI automation (#191), since CI will run these tests on every commit.
mprihoda commented 2026-03-14 10:51:23 +00:00 (Migrated from github.com)

Closed by 73db21e fix(test): Isolate E2E tests from real tmux server and dashboard

Closed by 73db21e fix(test): Isolate E2E tests from real tmux server and dashboard
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
iterative-works/iw-cli#193
No description provided.