Skip to content
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

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

pkwarren
Copy link
Contributor

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.

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
Copy link
Contributor Author

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 \
Copy link
Contributor Author

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)}"
Copy link
Contributor Author

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.

@pkwarren pkwarren merged commit 70bf6a9 into main Aug 31, 2023
6 checks passed
@pkwarren pkwarren deleted the pkw/improve-crosstest-execution branch August 31, 2023 20:20
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.

2 participants