Skip to content

Port integration test speed and stability fixes from integration/1.2 - #1824

Merged
kevinherron merged 2 commits into
mainfrom
t3code/port-integration-test-fixes
Jul 25, 2026
Merged

Port integration test speed and stability fixes from integration/1.2#1824
kevinherron merged 2 commits into
mainfrom
t3code/port-integration-test-fixes

Conversation

@kevinherron

Copy link
Copy Markdown
Contributor

Ports two integration-test commits from integration/1.2 to main rather than waiting for the distant merge:

Transport

  • OpcTcpServerTransport.unbind() now copies child channels out of the lock and closes them with syncUninterruptibly(), making unbind a real teardown barrier instead of returning while accepted channels are still open. Bind channels use syncUninterruptibly() too, replacing a loop that swallowed InterruptedException.
  • New TestPortAllocator reserves loopback ports across test JVMs via file locks, replacing the fixed port 12685 shared by OpcTcpTransportTest.
  • OpcTcpTransportTest threads the allocated port through a new endpointUrl() helper and unbinds in @AfterEach.

SDK integration tests

  • Surefire runs the module in two reusable forks.
  • TestServer allocates its port through TestPortAllocator instead of a random port with an unbounded recursive retry, and reuses the KeyStore plus both X509 identity certificates per JVM rather than generating three 2048-bit RSA keypairs on every TestServer.create(). The keystore also moves from the shared $TMPDIR/security path to a per-JVM temp dir so parallel forks do not contend.
  • SubscriptionTransferTest disconnects its second client in a finally.

Not ported

The EccSessionIntegrationTest certificate cache and ConditionRefreshTest synchronization hunks — both files are 1.2-only (ECC security policies, Alarms and Conditions).

53a34760d placed its regression test in OpcTcpServerTransportTest, a file introduced by the 1.2-only reverse connect work. Rather than port the unbind() change untested, that file is created here with only unbindClosesAcceptedChannelsBeforeReturning and its ServerApplicationContext helper.

Verification

mvn clean verify passes, spotless clean. The new unbind test was confirmed to be a genuine regression test: with the old unbind() body restored it fails on assertFalse(channel.isOpen()).

Integration test module time on one machine: ~69s before, ~45s after. 270 tests, 0 failures.

Note: TestServer now generates a fresh server certificate per JVM rather than reusing one persisted across runs. That is required for fork isolation and is harmless for these tests, but the server certificate is no longer stable between local runs.

🤖 Generated with Claude Code

kevinherron and others added 2 commits July 25, 2026 05:01
Allocate coordinated loopback ports instead of sharing a fixed listener
port, and make server unbind wait for accepted channels to close so test
invocations cannot leak network activity into each other.

Ported from integration/1.2 (53a3476). The unbind regression test is a
subset of that branch's OpcTcpServerTransportTest; its reverse-connect
test depends on code not yet on main.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Run integration tests in two reusable forks while coordinating port
allocation across JVMs. Reuse expensive certificate material and tighten
cleanup so parallel execution remains deterministic.

Ported from integration/1.2 (caf4baf), excluding the ECC session and
Condition refresh changes, which depend on code not yet on main. Local
integration test module time drops from ~69s to ~45s.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kevinherron
kevinherron merged commit a42d407 into main Jul 25, 2026
6 checks passed
@kevinherron
kevinherron deleted the t3code/port-integration-test-fixes branch July 25, 2026 12:19
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