Repository navigation
Use an available port for gRPC integration tests - #4320
Open
MoChiUaena wants to merge 1 commit into
Open
MoChiUaena wants to merge 1 commit into
MoChiUaena wants to merge 1 commit into
Conversation
The test application currently binds gRPC to the HTTP port plus one, which can already be occupied. Let gRPC bind an available port and have the route tests use the bound port. Stop the server when the Spring context closes, and cover startup with the adjacent port occupied. Signed-off-by: dlwlrma <965810157@qq.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gRPC integration app starts HTTP on a random port, then tries to bind gRPC to the next port. That adjacent port can already be occupied, causing the integration tests to fail at startup.
Bind gRPC to an available port and have the route tests use the bound port. The Spring-managed gRPC server now stops when the application context closes. A regression test reserves the previously assumed adjacent port, then checks that the app starts and releases its gRPC port on shutdown. The module also excludes generated protobuf sources from Checkstyle while keeping handwritten code checked.
Validation:
./mvnw -pl spring-cloud-gateway-integration-tests/grpc validatepassed Spring Java Format and Checkstyle. The three gRPC test classes passed (8 tests) with-pl spring-cloud-gateway-integration-tests/grpc -am -Ddisable.checks=true -Dtest=GRPCApplicationPortTests,GRPCApplicationTests,JsonToGrpcApplicationTests -Dsurefire.failIfNoSpecifiedTests=false verify. Checks are disabled only for that dependency-chain run because the unchanged WebFlux module currently reports 27 Checkstyle violations.