-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add test-framework package to gRPC transport module #20383
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
Open
finnegancarroll
wants to merge
11
commits into
opensearch-project:main
Choose a base branch
from
finnegancarroll:grpc-test-framework-merge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eb8067c
Add test-framework package to gRPC transport module.
finnegancarroll b676c87
Remove un-needed junit dependency & licenses.
finnegancarroll eae2b46
Add some trivial unit tests - Testing convention requires unit tests.
finnegancarroll 0c8022d
Spotless apply
finnegancarroll 75766da
Add gradle test commands to top level readme.
finnegancarroll f38b6ef
Javadocs.
finnegancarroll 1dca8b6
Remove use of GrpcUtil.NOOP_PROXY_DETECTOR. API is not stable in gRPC…
finnegancarroll 5e22876
Fix example code snippet. Thanks code rabbit
finnegancarroll 22e84b3
Remove dup protos dependency. Enable javadocs check on precommit.
finnegancarroll 4e635f5
Missing javadocs.
finnegancarroll 7cacdd4
Fix innacurate javadoc.
finnegancarroll File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # OpenSearch gRPC Transport Test Framework | ||
|
|
||
| The gRPC module test framework provides high-level abstractions for implementing integration tests for plugins which extend and utilize the gRPC transport. It solves the problem of breaking changes in protobuf schemas by providing stable APIs that abstract the underlying protobuf implementation details. When protobuf schemas change in the core gRPC transport module (e.g., protobuf field `SearchRequestBody` is renamed to `SearchRequest`), plugin tests that directly reference these protobuf classes break. This creates maintenance overhead and coupling between plugin tests and core implementation details. | ||
|
|
||
| ## Usage | ||
|
|
||
| Include in plugin integration tests by adding the following dependency to build.gradle. | ||
| ```gradle | ||
| dependencies { | ||
| testImplementation project(':modules:transport-grpc:test-framework') | ||
| } | ||
| ``` | ||
|
|
||
| Example usage of `OpenSearchIntegTestCase` and helper functions. | ||
| ```java | ||
| public class MyPluginTest extends OpenSearchIntegTestCase { | ||
|
|
||
| public void testMyPluginFeature() { | ||
| ManagedChannel plainTextGrpcChannel = NettyChannelBuilder.forAddress("localhost", 9200). | ||
| proxyDetector(NOOP_PROXY_DETECTOR). | ||
| usePlaintext() | ||
| .build(); | ||
finnegancarroll marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Bulk ingest test documents with gRPC | ||
| doBulk(plainTextGrpcChannel, "test-index", 3); | ||
| } | ||
| } | ||
finnegancarroll marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| apply plugin: 'opensearch.build' | ||
| apply plugin: 'opensearch.internal-cluster-test' | ||
|
|
||
| description = 'gRPC Transport Test Framework for Plugin Unit and Integration Tests' | ||
|
|
||
| dependencies { | ||
| api project(':test:framework') | ||
| api project(':modules:transport-grpc') | ||
| api project(path: ':modules:transport-grpc', configuration: 'testArtifacts') | ||
|
|
||
| api "org.opensearch:protobufs:${versions.opensearchprotobufs}" | ||
| api "io.grpc:grpc-protobuf:${versions.grpc}" | ||
finnegancarroll marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| api "io.grpc:grpc-api:${versions.grpc}" | ||
| api "io.grpc:grpc-core:${versions.grpc}" | ||
| api "io.grpc:grpc-netty-shaded:${versions.grpc}" | ||
| api "io.grpc:grpc-protobuf-lite:${versions.grpc}" | ||
| api "io.grpc:grpc-services:${versions.grpc}" | ||
| api "io.grpc:grpc-stub:${versions.grpc}" | ||
| api "io.grpc:grpc-util:${versions.grpc}" | ||
|
|
||
| api "junit:junit:${versions.junit}" | ||
|
|
||
| compileOnly "com.google.code.findbugs:jsr305:3.0.2" | ||
| runtimeOnly "com.google.guava:guava:${versions.guava}" | ||
| implementation "com.google.guava:failureaccess:1.0.2" | ||
| implementation "io.perfmark:perfmark-api:0.27.0" | ||
|
|
||
| testImplementation project(':test:framework') | ||
| internalClusterTestImplementation project(':modules:transport-grpc') | ||
| } | ||
|
|
||
| // Enable javadoc checks for precommit since this module has full coverage | ||
| precommit.dependsOn missingJavadoc | ||
|
|
||
| tasks.named("dependencyLicenses").configure { | ||
| mapping from: /grpc-.*/, to: 'grpc' | ||
| } | ||
|
|
||
| thirdPartyAudit { | ||
| ignoreMissingClasses( | ||
| 'com.aayushatharva.brotli4j.Brotli4jLoader', | ||
| 'com.aayushatharva.brotli4j.decoder.DecoderJNI$Status', | ||
| 'com.aayushatharva.brotli4j.decoder.DecoderJNI$Wrapper', | ||
| 'com.aayushatharva.brotli4j.encoder.BrotliEncoderChannel', | ||
| 'com.aayushatharva.brotli4j.encoder.Encoder$Mode', | ||
| 'com.aayushatharva.brotli4j.encoder.Encoder$Parameters', | ||
| 'com.google.gson.stream.JsonReader', | ||
| 'com.google.gson.stream.JsonToken', | ||
| 'com.google.protobuf.nano.CodedOutputByteBufferNano', | ||
| 'com.google.protobuf.nano.MessageNano', | ||
| 'com.google.protobuf.util.Durations', | ||
| 'com.google.protobuf.util.Timestamps', | ||
| 'com.google.rpc.Status', | ||
| 'com.google.rpc.Status$Builder', | ||
| 'com.ning.compress.BufferRecycler', | ||
| 'com.ning.compress.lzf.ChunkDecoder', | ||
| 'com.ning.compress.lzf.ChunkEncoder', | ||
| 'com.ning.compress.lzf.LZFChunk', | ||
| 'com.ning.compress.lzf.LZFEncoder', | ||
| 'com.ning.compress.lzf.util.ChunkDecoderFactory', | ||
| 'com.ning.compress.lzf.util.ChunkEncoderFactory', | ||
| 'lzma.sdk.lzma.Encoder', | ||
| 'net.jpountz.lz4.LZ4Compressor', | ||
| 'net.jpountz.lz4.LZ4Factory', | ||
| 'net.jpountz.lz4.LZ4FastDecompressor', | ||
| 'net.jpountz.xxhash.XXHash32', | ||
| 'net.jpountz.xxhash.XXHashFactory', | ||
| 'org.apache.log4j.Level', | ||
| 'org.apache.log4j.Logger', | ||
| 'org.bouncycastle.cert.X509v3CertificateBuilder', | ||
| 'org.bouncycastle.cert.jcajce.JcaX509CertificateConverter', | ||
| 'org.bouncycastle.openssl.PEMEncryptedKeyPair', | ||
| 'org.bouncycastle.openssl.PEMParser', | ||
| 'org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter', | ||
| 'org.bouncycastle.openssl.jcajce.JceOpenSSLPKCS8DecryptorProviderBuilder', | ||
| 'org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder', | ||
| 'org.bouncycastle.operator.jcajce.JcaContentSignerBuilder', | ||
| 'org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo', | ||
| 'org.conscrypt.AllocatedBuffer', | ||
| 'org.conscrypt.BufferAllocator', | ||
| 'org.conscrypt.Conscrypt', | ||
| 'org.conscrypt.HandshakeListener', | ||
| 'org.eclipse.jetty.alpn.ALPN', | ||
| 'org.eclipse.jetty.alpn.ALPN$ClientProvider', | ||
| 'org.eclipse.jetty.alpn.ALPN$ServerProvider', | ||
| 'org.eclipse.jetty.npn.NextProtoNego', | ||
| 'org.eclipse.jetty.npn.NextProtoNego$ClientProvider', | ||
| 'org.eclipse.jetty.npn.NextProtoNego$ServerProvider', | ||
| 'org.jboss.marshalling.ByteInput', | ||
| 'org.jboss.marshalling.ByteOutput', | ||
| 'org.jboss.marshalling.Marshaller', | ||
| 'org.jboss.marshalling.MarshallerFactory', | ||
| 'org.jboss.marshalling.MarshallingConfiguration', | ||
| 'org.jboss.marshalling.Unmarshaller', | ||
| 'reactor.blockhound.BlockHound$Builder', | ||
| 'reactor.blockhound.integration.BlockHoundIntegration' | ||
| ) | ||
|
|
||
| ignoreViolations( | ||
| 'com.google.common.cache.Striped64', | ||
| 'com.google.common.cache.Striped64$1', | ||
| 'com.google.common.cache.Striped64$Cell', | ||
| 'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray', | ||
| 'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$1', | ||
| 'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$2', | ||
| 'com.google.common.hash.Striped64', | ||
| 'com.google.common.hash.Striped64$1', | ||
| 'com.google.common.hash.Striped64$Cell', | ||
| 'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator', | ||
| 'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1', | ||
| 'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper', | ||
| 'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1', | ||
| 'io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator', | ||
| 'io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator$1', | ||
| 'io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator$2', | ||
| 'io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator$3', | ||
| 'io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator$4', | ||
| 'io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator$5', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$1', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$2', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$3', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$4', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$6', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseLinkedQueueConsumerNodeRef', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseLinkedQueueProducerNodeRef', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.LinkedQueueNode', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpmcArrayQueueConsumerIndexField', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpmcArrayQueueProducerIndexField', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.unpadded.MpscUnpaddedArrayQueueConsumerIndexField', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.unpadded.MpscUnpaddedArrayQueueProducerIndexField', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.unpadded.MpscUnpaddedArrayQueueProducerLimitField', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.util.UnsafeAccess', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.util.UnsafeLongArrayAccess', | ||
| 'io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.util.UnsafeRefArrayAccess' | ||
| ) | ||
| } | ||
1 change: 1 addition & 0 deletions
1
modules/transport-grpc/test-framework/licenses/failureaccess-1.0.2.jar.sha1
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| c4a06a64e650562f30b7bf9aaec1bfed43aca12b |
Oops, something went wrong.
Oops, something went wrong.
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.
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 would only be used by plugins that don't need to construct any protobuf requests at all right? Would security plugin be the only use case for this?
With the exception of OS major version releases (e.g. 4.x), we don't plan to make breaking changes to protos nowadays (as we've completed the proto automation to be able to make protos backward compatible), so would this PR still be needed long term?