Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: always connect peers more realistically #856

Merged
merged 2 commits into from
Oct 29, 2024

Commits on Oct 28, 2024

  1. test: always connect peers more realistically

    Our tests currenly connect `MapeoManager`s in two ways:
    
    1. By starting peer discovery servers and connecting. This is similar to
       what the real app does.
    2. By manually creating streams and connecting them in tests. This is
       less realistic.
    
    This commit removes the second way because:
    
    - it is less realistic
    - it lets us remove some test-only code in the `src/` directory
    - it will make an upcoming change easier
    
    I also tried to fix a possible (test-only) race condition, which *could*
    have been a reason for the less realistic option:
    
    1. Start connecting peers by calling `connectPeers()`. This begins the
       process of starting peer discovery servers.
    2. Disconnect them by calling the callback returned by `connectPeers()`.
    3. The peer discovery servers start, and begin connecting. *This is bad*
       because we already wanted to disconnect!
    EvanHahn committed Oct 28, 2024
    Configuration menu
    Copy the full SHA
    2e9e219 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    101c33a View commit details
    Browse the repository at this point in the history