[Bug] Raft instance strategy tests clear the running server singleton

Author: slievrlyCreated Sep 26, 2026Updated Sep 26, 2026

Check Ahead

  • Searched existing issues.
  • Willing to fix.

Issue Description

RaftServerInstanceStrategyTest resets every endpoint of the real shared Instance in its teardown, while its cached Spring context still owns a running Netty server. Later server shutdown dereferences the cleared transaction endpoint and logs a NullPointerException. The test also replaces the environment holder without restoring it.

Evidence

Java 17 CI job, commit 96e84e52f, shutdown error around raw line 23368. The test's resetInstance sets transaction to null; this is cross-test state pollution rather than an intentional null-endpoint scenario.

Expected behavior

Strategy tests exercise isolated mutable metadata, preserve the running server singleton, and restore environment state so subsequent tests and shutdown work normally.

Environment

Seata 2.8.0-SNAPSHOT, Java 17.