Skip to content

Commit

Permalink
Merge pull request #1093 from o-shevchenko/maxInboundMetadataSize_global
Browse files Browse the repository at this point in the history
Fix setting maxInboundMetadataSize from GLOBAL
  • Loading branch information
yidongnan authored Apr 19, 2024
2 parents fd47ce0 + d125ecc commit cbbef18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ public void copyDefaultsFrom(final GrpcChannelProperties config) {
if (this.maxInboundMessageSize == null) {
this.maxInboundMessageSize = config.maxInboundMessageSize;
}
if (this.maxInboundMetadataSize == null) {
this.maxInboundMetadataSize = config.maxInboundMetadataSize;
}
if (this.negotiationType == null) {
this.negotiationType = config.negotiationType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.util.unit.DataSize;

/**
* Tests whether the global property fallback works.
Expand All @@ -34,6 +35,8 @@
@SpringBootTest(properties = {
"grpc.client.GLOBAL.keepAliveTime=23m",
"grpc.client.GLOBAL.keepAliveTimeout=31s",
"grpc.client.GLOBAL.maxInboundMessageSize=5MB",
"grpc.client.GLOBAL.maxInboundMetadataSize=3MB",
"grpc.client.test.keepAliveTime=42m"})
class GrpcChannelPropertiesGlobalTest {

Expand All @@ -52,4 +55,11 @@ void test() {
assertEquals(Duration.ofSeconds(31), this.grpcChannelsProperties.getChannel("test").getKeepAliveTimeout());
}

@Test
void testCopyDefaults() {
assertEquals(DataSize.ofMegabytes(5),
this.grpcChannelsProperties.getChannel("test").getMaxInboundMessageSize());
assertEquals(DataSize.ofMegabytes(3),
this.grpcChannelsProperties.getChannel("test").getMaxInboundMetadataSize());
}
}

0 comments on commit cbbef18

Please sign in to comment.