Skip to content

integration: add stress and multiplexing tests#54

Open
shubhamdhama wants to merge 1 commit intoshubham/enable-stream-multiplexingfrom
shubham/testsmaxxing
Open

integration: add stress and multiplexing tests#54
shubhamdhama wants to merge 1 commit intoshubham/enable-stream-multiplexingfrom
shubham/testsmaxxing

Conversation

@shubhamdhama
Copy link
Copy Markdown

Add stress tests targeting concurrency bugs in the multiplexing stack
(MuxWriter, packetQueue, manager, activeStreams) and correctness tests
for stream isolation under cancel, error, and connection close.

Stress tests (stress_test.go):

  • SustainedConcurrentStreams: 50 bidi streams x 100 echo messages,
    validates no cross-stream data corruption.
  • RapidOpenCloseCycles: 500 sequential create/use/destroy cycles on one
    connection.
  • CancelStorm: 30 streams with ~50% randomly cancelled mid-traffic,
    verifying cancel isolation.
  • ShutdownDuringActivity: conn.Close() with 20 active streams, deadlock
    detection.
  • MixedRPCTypes: 30 goroutines x 10 rounds of randomly chosen RPC types
    (unary, client-streaming, server-streaming, bidi) on one connection.
  • ConcurrentCancelCloseTransportClose: triple-race shutdown (cancel +
    conn.Close + transport.Close) with active streams.
  • ConcurrentUnary: 100 goroutines x 50 unary RPCs (sustained throughput).
  • BurstUnary: 1000 goroutines x 1 unary RPC (burst contention).

Multiplexing tests (multiplex_test.go):

  • CancelIsolation, ErrorIsolation, ConnCloseWithActiveStreams,
    TransportCloseTerminatesAllStreams.

Transport selection is randomized per test (pipe or TCP loopback), with
a -stress.transport flag override for deterministic reproduction. All
tests use goleak for goroutine leak detection.

Moves TestConcurrentStreams and TestConcurrent from simple_test.go into
the stress suite as SustainedConcurrentStreams and BurstUnary.

Add stress tests targeting concurrency bugs in the multiplexing stack
(MuxWriter, packetQueue, manager, activeStreams) and correctness tests
for stream isolation under cancel, error, and connection close.

Stress tests (stress_test.go):
- SustainedConcurrentStreams: 50 bidi streams x 100 echo messages,
  validates no cross-stream data corruption.
- RapidOpenCloseCycles: 500 sequential create/use/destroy cycles on one
  connection.
- CancelStorm: 30 streams with ~50% randomly cancelled mid-traffic,
  verifying cancel isolation.
- ShutdownDuringActivity: conn.Close() with 20 active streams, deadlock
  detection.
- MixedRPCTypes: 30 goroutines x 10 rounds of randomly chosen RPC types
  (unary, client-streaming, server-streaming, bidi) on one connection.
- ConcurrentCancelCloseTransportClose: triple-race shutdown (cancel +
  conn.Close + transport.Close) with active streams.
- ConcurrentUnary: 100 goroutines x 50 unary RPCs (sustained throughput).
- BurstUnary: 1000 goroutines x 1 unary RPC (burst contention).

Multiplexing tests (multiplex_test.go):
- CancelIsolation, ErrorIsolation, ConnCloseWithActiveStreams,
  TransportCloseTerminatesAllStreams.

Transport selection is randomized per test (pipe or TCP loopback), with
a -transport flag override for deterministic reproduction. All tests use
goleak for goroutine leak detection.

Moves TestConcurrentStreams and TestConcurrent from simple_test.go into
the stress suite as SustainedConcurrentStreams and BurstUnary.
@shubhamdhama shubhamdhama force-pushed the shubham/testsmaxxing branch from 3eedc39 to ad9443c Compare April 13, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant