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

Update references for crosstests #85

Merged
merged 20 commits into from
Sep 6, 2023
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
git diff-index --quiet HEAD --
- name: Build project
run: make build
crosstests:
conformance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -53,10 +53,8 @@ jobs:
- uses: actions/setup-go@v4
with:
cache: false
- name: Generate proto files for cross tests.
run: make generatecrosstests
- name: Run crosstests
run: make crosstestsrun
- name: Run conformance tests
run: make conformancerun
license-headers:
runs-on: ubuntu-latest
steps:
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ buildplugin: ## Build the connect-kotlin protoc plugin.
clean: ## Cleans the underlying build.
./gradlew $(GRADLE_ARGS) clean

.PHONY: crosstestsrun
crosstestsrun: crosstestsrunjava ## Run the cross tests.
.PHONY: conformancerun
conformancerun: conformancerunjava ## Run the conformance tests.

.PHONY: crosstestsrunjava
crosstestsrunjava: generate ## Run the cross tests for protoc-gen-java integration.
./gradlew $(GRADLE_ARGS) crosstest:google-java:test
.PHONY: conformancerunjava
conformancerunjava: generate ## Run the conformance tests for protoc-gen-java integration.
./gradlew $(GRADLE_ARGS) conformance:google-java:test

ifeq ($(UNAME_OS),Darwin)
PROTOC_OS := osx
Expand Down Expand Up @@ -69,14 +69,14 @@ $(PROTOC):
@touch $@

.PHONY: generate
generate: $(PROTOC) buildplugin generatecrosstests generateexamples ## Generate proto files for the entire project.
generate: $(PROTOC) buildplugin generateconformance generateexamples ## Generate proto files for the entire project.
buf generate --template protoc-gen-connect-kotlin/buf.gen.yaml -o protoc-gen-connect-kotlin
buf generate --template extensions/buf.gen.yaml -o extensions buf.build/googleapis/googleapis
make licenseheaders

.PHONY: generatecrosstests
generatecrosstests: $(PROTOC) buildplugin ## Generate protofiles for cross tests.
buf generate --template crosstests/buf.gen.yaml -o crosstests
.PHONY: generateconformance
generateconformance: $(PROTOC) buildplugin ## Generate protofiles for conformance tests.
buf generate --template conformance/buf.gen.yaml -o conformance

.PHONY: generateexamples
generateexamples: $(PROTOC) buildplugin ## Generate proto files for example apps.
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Comprehensive documentation for everything, including
[interceptors][interceptors], [streaming][streaming], and [error handling][error-handling]
is available on the [connect.build website][getting-started].

## Generation Options
## Generation Options

| **Option** | **Type** | **Default** | **Details** |
|--------------------------------|:--------:|:-----------:|-------------------------------------------------|
Expand All @@ -114,10 +114,10 @@ is available on the [connect.build website][getting-started].

## Example Apps

Example apps are available in [`/examples`](./examples). First, run `make generate` to generate
Example apps are available in [`/examples`](./examples). First, run `make generate` to generate
code for the Protobuf plugins.

For the [Android example](./examples/android), you can run `make installandroid` to build and install
For the [Android example](./examples/android), you can run `make installandroid` to build and install
a fully functional Android application using Connect-Kotlin.

Additionally, there are pure Kotlin examples that demonstrate a simple main executable using Connect-Kotlin:
Expand Down Expand Up @@ -146,10 +146,10 @@ for details.
## Ecosystem

* [connect-swift]: Swift clients for idiomatic gRPC & Connect RPC
* [connect-web]: TypeScript clients for web browsers
* [connect-es]: Type-safe APIs with Protobuf and TypeScript.
* [connect-go]: Service handlers and clients for GoLang
* [Buf Studio][buf-studio]: web UI for ad-hoc RPCs
* [connect-crosstest]: gRPC and gRPC-Web interoperability tests
* [conformance]: Connect, gRPC, and gRPC-Web interoperability tests

## Status

Expand All @@ -162,11 +162,11 @@ Offered under the [Apache 2 license][license].

[blog]: https://buf.build/blog/connect-a-better-grpc
[buf-studio]: https://buf.build/studio
[connect-crosstest]: https://github.com/bufbuild/connect-crosstest
[connect-go]: https://github.com/bufbuild/connect-go
[conformance]: https://github.com/connectrpc/conformance
[connect-go]: https://github.com/connectrpc/connect-go
[connect-protocol]: https://connect.build/docs/protocol
[connect-swift]: https://github.com/bufbuild/connect-swift
[connect-web]: https://www.npmjs.com/package/@bufbuild/connect-web
[connect-es]: https://github.com/connectrpc/connect-es
[error-handling]: https://connect.build/docs/kotlin/errors
[getting-started]: https://connect.build/docs/kotlin/getting-started
[grpc-protocol]: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
Expand Down
2 changes: 1 addition & 1 deletion buf.work.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: v1
directories:
- crosstests/proto
- conformance/proto
- protoc-gen-connect-kotlin/proto
4 changes: 2 additions & 2 deletions crosstests/buf.gen.yaml → conformance/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: v1
managed:
enabled: true
plugins:
# Java crosstests.
# Java conformance.
- plugin: connect-kotlin
out: google-java/build/generated/sources/bufgen
path: ./protoc-gen-connect-kotlin/build/install/protoc-gen-connect-kotlin/bin/protoc-gen-connect-kotlin
Expand All @@ -16,7 +16,7 @@ plugins:
- plugin: kotlin
out: google-java/build/generated/sources/bufgen
protoc_path: .tmp/bin/protoc
# Javalite crosstests.
# Javalite conformance.
- plugin: connect-kotlin
out: google-javalite/build/generated/sources/bufgen
path: ./protoc-gen-connect-kotlin/build/install/protoc-gen-connect-kotlin/bin/protoc-gen-connect-kotlin
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package build.buf.connect.crosstest.ssl
package com.connectrpc.conformance.ssl

import okhttp3.tls.HandshakeCertificates
import okhttp3.tls.HeldCertificate
Expand All @@ -32,7 +32,7 @@ fun sslContext(): Pair<SSLSocketFactory, X509TrustManager> {
val certificate = clientCert.byteInputStream(Charsets.UTF_8).use { stream ->
CertificateFactory.getInstance("X.509").generateCertificate(stream) as X509Certificate
}
val certificateAuthority = crosstestCACert.byteInputStream(Charsets.UTF_8).use { stream ->
val certificateAuthority = conformanceCACert.byteInputStream(Charsets.UTF_8).use { stream ->
CertificateFactory.getInstance("X.509").generateCertificate(stream) as X509Certificate
}
val publicKey = certificate.getPublicKey() as RSAPublicKey
Expand All @@ -56,7 +56,7 @@ fun sslContext(): Pair<SSLSocketFactory, X509TrustManager> {
return result.sslSocketFactory() to result.trustManager
}

// https://github.com/bufbuild/connect-crosstest/blob/main/cert/client.crt
// https://github.com/connectrpc/conformance/blob/main/cert/client.crt
// cert issues: https://stackoverflow.com/questions/9210514/unable-to-find-valid-certification-path-to-requested-target-error-even-after-c
private const val clientCert = """-----BEGIN CERTIFICATE-----
MIIEODCCAiCgAwIBAgIRAJTCeo42f8lts3VeDnN7CVwwDQYJKoZIhvcNAQELBQAw
Expand Down Expand Up @@ -84,9 +84,9 @@ FjL/opqnz8GV8od9hLHJfwclPBSEA0fp7yNvOzKm1lNPEX009ME1hK4dLKNCqv3x
g+mJcflVCfjEqJzfEy4wPq5SJzOIzXva6DyBpA==
-----END CERTIFICATE-----"""

// https://github.com/bufbuild/connect-crosstest/blob/main/cert/CrosstestCA.crt
// https://github.com/connectrpc/conformance/blob/main/cert/ConformanceCA.crt
// Certificate authority for the trusted cert.
private const val crosstestCACert = """-----BEGIN CERTIFICATE-----
private const val conformanceCACert = """-----BEGIN CERTIFICATE-----
MIIE7DCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDEwtDcm9z
c3Rlc3RDQTAeFw0yMjA1MDMxNzA5NTlaFw0yMzExMDMxNzE5NTZaMBYxFDASBgNV
BAMTC0Nyb3NzdGVzdENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
Expand Down Expand Up @@ -149,7 +149,7 @@ YfnVHhS0VV49dKIqrsP8o1qZJRhjcq/J/Rrm2ZFHfdLCOOnd9VG4W2I1WB9MDc4t
raq4CptHPEywZgBR95C0Jv3y
-----END PRIVATE KEY-----"""

// https://github.com/bufbuild/connect-crosstest/blob/main/cert/client.key
// https://github.com/connectrpc/conformance/blob/main/cert/client.key
const val rsaClientKey = """-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAqCSOgQ3rFjxEZu84yxgPT6dF0kd656XnF0yiAcGpq9+YK/yL
eIwGTDAVAR4XbywdKQI9f4ZVi7w0ErkAb37K9iq6jr7VTj9HOSgs8B47y5soYb4z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package build.buf.connect.crosstest.ssl
package com.connectrpc.conformance.ssl

/**
* Test suite for the different cross testing for
* Test suite for the different conformance testing for
* protoc-gen-java, protoc-gen-javalite.
*
* Primarily to help keep all the suites in sync.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sourceSets {
dependencies {
implementation(libs.kotlin.coroutines.core)
implementation(libs.protobuf.kotlin)
implementation(project(":crosstests:common"))
implementation(project(":conformance:common"))
implementation(project(":extensions:google-java"))
implementation(project(":okhttp"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package build.buf.connect.crosstest
package com.connectrpc.conformance

import build.buf.connect.Code
import build.buf.connect.ProtocolClientConfig
import build.buf.connect.RequestCompression
import build.buf.connect.compression.GzipCompressionPool
import build.buf.connect.crosstest.ssl.sslContext
import build.buf.connect.extensions.GoogleJavaProtobufStrategy
import build.buf.connect.impl.ProtocolClient
import build.buf.connect.okhttp.ConnectOkHttpClient
import build.buf.connect.protocols.NetworkProtocol
import com.connectrpc.conformance.ssl.sslContext
import com.google.protobuf.ByteString
import com.grpc.testing.ErrorDetail
import com.grpc.testing.TestServiceClient
Expand Down Expand Up @@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit


@RunWith(Parameterized::class)
class CrossTest(
class Conformance(
private val protocol: NetworkProtocol
) {
private lateinit var connectClient: ProtocolClient
Expand All @@ -65,7 +65,7 @@ class CrossTest(
private lateinit var testServiceConnectClient: TestServiceClient

companion object {
const val CROSSTEST_VERSION = "162d496c009e2ffb1a638b4a2ea789e9cc3331bb"
const val CONFORMANCE_VERSION = "162d496c009e2ffb1a638b4a2ea789e9cc3331bb"

@JvmStatic
@Parameters(name = "protocol")
Expand All @@ -78,7 +78,7 @@ class CrossTest(

@JvmField
@ClassRule
val CROSSTEST_CONTAINER = GenericContainer("bufbuild/connect-crosstest:$CROSSTEST_VERSION")
val CONFORMANCE_CONTAINER = GenericContainer("connectrpc/conformance:$CONFORMANCE_VERSION")
.withExposedPorts(8080, 8081)
.withCommand(
"/usr/local/bin/serverconnect",
Expand All @@ -95,7 +95,7 @@ class CrossTest(

@Before
fun before() {
val host = "https://localhost:${CROSSTEST_CONTAINER.getMappedPort(8081)}"
val host = "https://localhost:${CONFORMANCE_CONTAINER.getMappedPort(8081)}"
val (sslSocketFactory, trustManager) = sslContext()
val client = OkHttpClient.Builder()
.protocols(listOf(Protocol.HTTP_2, Protocol.HTTP_1_1))
Expand Down Expand Up @@ -141,7 +141,7 @@ class CrossTest(
val countDownLatch = CountDownLatch(1)
val expectedErrorDetail = errorDetail {
reason = "soirée 🎉"
domain = "connect-crosstest"
domain = "connect-conformance"
}
val stream = testServiceConnectClient.failStreamingOutputCall()
val sizes = listOf(
Expand Down Expand Up @@ -375,7 +375,7 @@ class CrossTest(
fun failUnary(): Unit = runBlocking {
val expectedErrorDetail = errorDetail {
reason = "soirée 🎉"
domain = "connect-crosstest"
domain = "connect-conformance"
}
val countDownLatch = CountDownLatch(1)
testServiceConnectClient.failUnaryCall(simpleRequest {}) { response ->
Expand Down Expand Up @@ -512,7 +512,7 @@ class CrossTest(
fun failUnaryBlocking(): Unit = runBlocking {
val expectedErrorDetail = errorDetail {
reason = "soirée 🎉"
domain = "connect-crosstest"
domain = "connect-conformance"
}
val response = testServiceConnectClient.failUnaryCallBlocking(simpleRequest {}).execute()
assertThat(response.code).isEqualTo(Code.RESOURCE_EXHAUSTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sourceSets {
dependencies {
implementation(libs.kotlin.coroutines.core)
implementation(libs.protobuf.kotlin)
implementation(project(":crosstests:common"))
implementation(project(":conformance:common"))
implementation(project(":extensions:google-java"))
implementation(project(":okhttp"))

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
rootProject.name = "connect-kotlin"

include(":crosstests:common")
include(":crosstests:google-java")
include(":crosstests:google-javalite")
include(":conformance:common")
include(":conformance:google-java")
include(":conformance:google-javalite")
if (extra.has("skipAndroid") && extra.get("skipAndroid").toString().toBoolean()) {
println("Skipping Android build (skipAndroid=true)")
} else {
Expand Down
Loading