-
Notifications
You must be signed in to change notification settings - Fork 17
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
Migrate crosstests to use testcontainers #84
Conversation
Instead of manually having to exclude tests from `./gradlew build` (since the crosstest tests fail if the Docker server isn't running), migrate the crosstests to use testcontainers to spin up the server so the tests can always run. This also simplifies the makefile - we no longer need to manually start/stop the crosstests server and also don't need to bind to static ports on the host - it will use ephemeral ports.
@@ -26,7 +25,7 @@ $(BIN)/license-headers: Makefile | |||
|
|||
.PHONY: build | |||
build: generate ## Build the entire project. | |||
./gradlew $(GRADLE_ARGS) build -x test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smallsamantha - I noticed there were real compile errors in the tests which weren't getting reported in any of the CI checks as part of #79. This should resolve that.
docker run --rm --name serverconnect -p 8080:8080 -p 8081:8081 -d \ | ||
bufbuild/connect-crosstest:$(CROSSTEST_VERSION) \ | ||
/usr/local/bin/serverconnect --h1port "8080" --h2port "8081" --cert "cert/localhost.crt" --key "cert/localhost.key" | ||
docker run --rm --name servergrpc -p 8083:8083 -d \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: I never saw anything connect to anything other than the h2port of the connect server. If we want to extend the tests to hit the gRPC server we should do that.
} | ||
|
||
@Before | ||
fun before() { | ||
val port = 8081 | ||
val host = "https://localhost:$port" | ||
val host = "https://localhost:${CROSSTEST_CONTAINER.getMappedPort(8081)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will use an ephemeral port so it won't fail if something else is bound to 8080/8081.
Instead of manually having to exclude tests from
./gradlew build
(since the crosstest tests fail if the Docker server isn't running), migrate the crosstests to use testcontainers to spin up the server so the tests can always run. This also simplifies the makefile - we no longer need to manually start/stop the crosstests server and also don't need to bind to static ports on the host - it will use ephemeral ports.