Merge pull request #7626 from nicolasnoble/manual-upmerge-after-version-bump

Manual upmerge after version bump.
pull/7447/head
Nicolas Noble 9 years ago committed by GitHub
commit f14effb6e4
  1. 6
      src/csharp/Grpc.Auth/project.json
  2. 2
      src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs
  3. 2
      src/csharp/Grpc.Core.Tests/NUnitMain.cs
  4. 2
      src/csharp/Grpc.Core.Tests/SanityTest.cs
  5. 5
      src/csharp/Grpc.Core.Tests/project.json
  6. 4
      src/csharp/Grpc.Core/project.json
  7. 5
      src/csharp/Grpc.Examples.MathClient/project.json
  8. 5
      src/csharp/Grpc.Examples.MathServer/project.json
  9. 2
      src/csharp/Grpc.Examples.Tests/NUnitMain.cs
  10. 5
      src/csharp/Grpc.Examples.Tests/project.json
  11. 2
      src/csharp/Grpc.Examples/project.json
  12. 2
      src/csharp/Grpc.HealthCheck.Tests/NUnitMain.cs
  13. 5
      src/csharp/Grpc.HealthCheck.Tests/project.json
  14. 2
      src/csharp/Grpc.HealthCheck/project.json
  15. 5
      src/csharp/Grpc.IntegrationTesting.Client/project.json
  16. 5
      src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json
  17. 5
      src/csharp/Grpc.IntegrationTesting.Server/project.json
  18. 5
      src/csharp/Grpc.IntegrationTesting.StressClient/project.json
  19. 2
      src/csharp/Grpc.IntegrationTesting/GeneratedClientTest.cs
  20. 10
      src/csharp/Grpc.IntegrationTesting/InteropClient.cs
  21. 2
      src/csharp/Grpc.IntegrationTesting/NUnitMain.cs
  22. 7
      src/csharp/Grpc.IntegrationTesting/project.json
  23. 5
      src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
  24. 11
      src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
  25. 6
      src/objective-c/GRPCClient/GRPCCall+Tests.h
  26. 3
      src/objective-c/GRPCClient/GRPCCall+Tests.m
  27. 14
      src/objective-c/GRPCClient/private/GRPCChannel.m
  28. 5
      src/objective-c/GRPCClient/private/GRPCHost.h
  29. 12
      src/objective-c/GRPCClient/private/GRPCHost.m
  30. 9
      src/objective-c/tests/GRPCClientTests.m
  31. 7
      src/objective-c/tests/InteropTests.h
  32. 73
      src/objective-c/tests/InteropTests.m
  33. 8
      src/objective-c/tests/InteropTestsLocalCleartext.m
  34. 8
      src/objective-c/tests/InteropTestsLocalSSL.m
  35. 4
      src/objective-c/tests/InteropTestsRemote.m
  36. 6
      src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme
  37. 6
      templates/src/csharp/Grpc.Auth/project.json.template
  38. 5
      templates/src/csharp/Grpc.Core.Tests/project.json.template
  39. 4
      templates/src/csharp/Grpc.Core/project.json.template
  40. 5
      templates/src/csharp/Grpc.Examples.MathClient/project.json.template
  41. 5
      templates/src/csharp/Grpc.Examples.MathServer/project.json.template
  42. 5
      templates/src/csharp/Grpc.Examples.Tests/project.json.template
  43. 2
      templates/src/csharp/Grpc.Examples/project.json.template
  44. 5
      templates/src/csharp/Grpc.HealthCheck.Tests/project.json.template
  45. 2
      templates/src/csharp/Grpc.HealthCheck/project.json.template
  46. 5
      templates/src/csharp/Grpc.IntegrationTesting.Client/project.json.template
  47. 5
      templates/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json.template
  48. 5
      templates/src/csharp/Grpc.IntegrationTesting.Server/project.json.template
  49. 5
      templates/src/csharp/Grpc.IntegrationTesting.StressClient/project.json.template
  50. 7
      templates/src/csharp/Grpc.IntegrationTesting/project.json.template
  51. 2
      tools/run_tests/build_csharp_coreclr.sh
  52. 7
      tools/run_tests/build_package_node.sh

@ -32,9 +32,9 @@
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027", "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.5.0-rc2-24027", "NETStandard.Library": "1.6.0",
"System.Threading.Tasks": "4.0.11-rc2-24027" "System.Threading.Tasks": "4.0.11"
} }
} }
} }

@ -40,7 +40,7 @@ namespace Grpc.Core.Tests
{ {
public class AppDomainUnloadTest public class AppDomainUnloadTest
{ {
#if NETSTANDARD1_5 #if NETCOREAPP1_0
[Test] [Test]
[Ignore("Not supported for CoreCLR")] [Ignore("Not supported for CoreCLR")]
public void AppDomainUnloadHookCanCleanupAbandonedCall() public void AppDomainUnloadHookCanCleanupAbandonedCall()

@ -49,7 +49,7 @@ namespace Grpc.Core.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if NETSTANDARD1_5 #if NETCOREAPP1_0
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);

@ -46,7 +46,7 @@ namespace Grpc.Core.Tests
public class SanityTest public class SanityTest
{ {
// TODO: make sanity test work for CoreCLR as well // TODO: make sanity test work for CoreCLR as well
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
/// <summary> /// <summary>
/// Because we depend on a native library, sometimes when things go wrong, the /// Because we depend on a native library, sometimes when things go wrong, the
/// entire NUnit test process crashes. To be able to track down problems better, /// entire NUnit test process crashes. To be able to track down problems better,

@ -61,12 +61,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
}, },

@ -40,8 +40,8 @@
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027", "NETStandard.Library": "1.6.0",
"System.Threading.Thread": "4.0.0-rc2-24027" "System.Threading.Thread": "4.0.0"
} }
} }
} }

@ -55,12 +55,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -55,12 +55,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -49,7 +49,7 @@ namespace Grpc.Examples.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if NETSTANDARD1_5 #if NETCOREAPP1_0
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);

@ -57,12 +57,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -20,7 +20,7 @@
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "NETStandard.Library": "1.6.0"
} }
} }
} }

@ -49,7 +49,7 @@ namespace Grpc.HealthCheck.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if NETSTANDARD1_5 #if NETCOREAPP1_0
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);

@ -57,12 +57,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -37,7 +37,7 @@
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "NETStandard.Library": "1.6.0"
} }
} }
} }

@ -57,13 +57,14 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -57,13 +57,14 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -57,13 +57,14 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -57,13 +57,14 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -49,7 +49,7 @@ namespace Grpc.IntegrationTesting
TestService.TestServiceClient unimplementedClient = new UnimplementedTestServiceClient(); TestService.TestServiceClient unimplementedClient = new UnimplementedTestServiceClient();
// TODO: replace Moq by some mocking library with CoreCLR support. // TODO: replace Moq by some mocking library with CoreCLR support.
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
[Test] [Test]
public void ExpandedParamOverloadCanBeMocked() public void ExpandedParamOverloadCanBeMocked()
{ {

@ -145,7 +145,7 @@ namespace Grpc.IntegrationTesting
if (options.TestCase == "jwt_token_creds") if (options.TestCase == "jwt_token_creds")
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); var googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
Assert.IsTrue(googleCredential.IsCreateScopedRequired); Assert.IsTrue(googleCredential.IsCreateScopedRequired);
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials());
@ -157,7 +157,7 @@ namespace Grpc.IntegrationTesting
if (options.TestCase == "compute_engine_creds") if (options.TestCase == "compute_engine_creds")
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); var googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
Assert.IsFalse(googleCredential.IsCreateScopedRequired); Assert.IsFalse(googleCredential.IsCreateScopedRequired);
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials());
@ -395,7 +395,7 @@ namespace Grpc.IntegrationTesting
public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope) public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope)
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
Console.WriteLine("running oauth2_auth_token"); Console.WriteLine("running oauth2_auth_token");
ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope }); ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope });
string oauth2Token = await credential.GetAccessTokenForRequestAsync(); string oauth2Token = await credential.GetAccessTokenForRequestAsync();
@ -421,7 +421,7 @@ namespace Grpc.IntegrationTesting
public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope) public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope)
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
Console.WriteLine("running per_rpc_creds"); Console.WriteLine("running per_rpc_creds");
ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
@ -731,7 +731,7 @@ namespace Grpc.IntegrationTesting
// extracts the client_email field from service account file used for auth test cases // extracts the client_email field from service account file used for auth test cases
private static string GetEmailFromServiceAccountFile() private static string GetEmailFromServiceAccountFile()
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS"); string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS");
Assert.IsNotNull(keyFile); Assert.IsNotNull(keyFile);
var jobject = JObject.Parse(File.ReadAllText(keyFile)); var jobject = JObject.Parse(File.ReadAllText(keyFile));

@ -49,7 +49,7 @@ namespace Grpc.IntegrationTesting
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if NETSTANDARD1_5 #if NETCOREAPP1_0
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);

@ -72,14 +72,15 @@
"System.IO": "" "System.IO": ""
} }
}, },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027", "Microsoft.NETCore.App": "1.0.0",
"System.Linq.Expressions": "4.0.11-rc2-24027" "NETStandard.Library": "1.6.0",
"System.Linq.Expressions": "4.1.0"
} }
} }
} }

@ -43,7 +43,10 @@
* Use the provided @c userAgentPrefix at the beginning of the HTTP User Agent string for all calls * Use the provided @c userAgentPrefix at the beginning of the HTTP User Agent string for all calls
* to the specified @c host. * to the specified @c host.
*/ */
+ (void)setUserAgentPrefix:(NSString *)userAgentPrefix forHost:(NSString *)host; + (void)setUserAgentPrefix:(nonnull NSString *)userAgentPrefix forHost:(nonnull NSString *)host;
/** The default response size limit is 4MB. Set this to override that default. */
+ (void)setResponseSizeLimit:(NSUInteger)limit forHost:(nonnull NSString *)host;
+ (void)closeOpenConnections DEPRECATED_MSG_ATTRIBUTE("The API for this feature is experimental, " + (void)closeOpenConnections DEPRECATED_MSG_ATTRIBUTE("The API for this feature is experimental, "
"and might be removed or modified at any " "and might be removed or modified at any "

@ -37,15 +37,16 @@
@implementation GRPCCall (ChannelArg) @implementation GRPCCall (ChannelArg)
+ (void)setUserAgentPrefix:(NSString *)userAgentPrefix forHost:(NSString *)host { + (void)setUserAgentPrefix:(nonnull NSString *)userAgentPrefix forHost:(nonnull NSString *)host {
if (!host) {
[NSException raise:NSInvalidArgumentException
format:@"host and userAgentPrefix must be provided."];
}
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host]; GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
hostConfig.userAgentPrefix = userAgentPrefix; hostConfig.userAgentPrefix = userAgentPrefix;
} }
+ (void)setResponseSizeLimit:(NSUInteger)limit forHost:(nonnull NSString *)host {
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
hostConfig.responseSizeLimitOverride = @(limit);
}
+ (void)closeOpenConnections { + (void)closeOpenConnections {
[GRPCHost flushChannelCache]; [GRPCHost flushChannelCache];
} }

@ -57,4 +57,10 @@
* more than one invocation of the methods of this category. * more than one invocation of the methods of this category.
*/ */
+ (void)useInsecureConnectionsForHost:(NSString *)host; + (void)useInsecureConnectionsForHost:(NSString *)host;
/**
* Resets all host configurations to their default values, and flushes all connections from the
* cache.
*/
+ (void)resetHostSettings;
@end @end

@ -61,4 +61,7 @@
hostConfig.secure = NO; hostConfig.secure = NO;
} }
+ (void)resetHostSettings {
[GRPCHost resetAllHostSettings];
}
@end @end

@ -47,7 +47,7 @@
#endif #endif
#import "GRPCCompletionQueue.h" #import "GRPCCompletionQueue.h"
void freeChannelArgs(grpc_channel_args *channel_args) { static void FreeChannelArgs(grpc_channel_args *channel_args) {
for (size_t i = 0; i < channel_args->num_args; ++i) { for (size_t i = 0; i < channel_args->num_args; ++i) {
grpc_arg *arg = &channel_args->args[i]; grpc_arg *arg = &channel_args->args[i];
gpr_free(arg->key); gpr_free(arg->key);
@ -65,7 +65,7 @@ void freeChannelArgs(grpc_channel_args *channel_args) {
* value responds to @c @selector(intValue). Otherwise, an exception will be raised. The caller of * value responds to @c @selector(intValue). Otherwise, an exception will be raised. The caller of
* this function is responsible for calling @c freeChannelArgs on a non-NULL returned value. * this function is responsible for calling @c freeChannelArgs on a non-NULL returned value.
*/ */
grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) { static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) {
if (!dictionary) { if (!dictionary) {
return NULL; return NULL;
} }
@ -115,9 +115,11 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
} }
if (self = [super init]) { if (self = [super init]) {
_channelArgs = buildChannelArgs(channelArgs); _channelArgs = BuildChannelArgs(channelArgs);
_host = [host copy]; _host = [host copy];
_unmanagedChannel = grpc_cronet_secure_channel_create(cronetEngine, _host.UTF8String, _channelArgs, _unmanagedChannel = grpc_cronet_secure_channel_create(cronetEngine,
_host.UTF8String,
_channelArgs,
NULL); NULL);
} }
@ -138,7 +140,7 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
} }
if (self = [super init]) { if (self = [super init]) {
_channelArgs = buildChannelArgs(channelArgs); _channelArgs = BuildChannelArgs(channelArgs);
_host = [host copy]; _host = [host copy];
if (secure) { if (secure) {
_unmanagedChannel = grpc_secure_channel_create(credentials, _host.UTF8String, _channelArgs, _unmanagedChannel = grpc_secure_channel_create(credentials, _host.UTF8String, _channelArgs,
@ -155,7 +157,7 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
// TODO(jcanizales): Be sure to add a test with a server that closes the connection prematurely, // TODO(jcanizales): Be sure to add a test with a server that closes the connection prematurely,
// as in the past that made this call to crash. // as in the past that made this call to crash.
grpc_channel_destroy(_unmanagedChannel); grpc_channel_destroy(_unmanagedChannel);
freeChannelArgs(_channelArgs); FreeChannelArgs(_channelArgs);
} }
#ifdef GRPC_COMPILE_WITH_CRONET #ifdef GRPC_COMPILE_WITH_CRONET

@ -42,6 +42,7 @@ struct grpc_channel_credentials;
@interface GRPCHost : NSObject @interface GRPCHost : NSObject
+ (void)flushChannelCache; + (void)flushChannelCache;
+ (void)resetAllHostSettings;
@property(nonatomic, readonly) NSString *address; @property(nonatomic, readonly) NSString *address;
@property(nonatomic, copy, nullable) NSString *userAgentPrefix; @property(nonatomic, copy, nullable) NSString *userAgentPrefix;
@ -53,6 +54,10 @@ struct grpc_channel_credentials;
@property(nonatomic, copy, nullable) NSString *hostNameOverride; @property(nonatomic, copy, nullable) NSString *hostNameOverride;
/** The default response size limit is 4MB. Set this to override that default. */
@property(nonatomic, strong, nullable) NSNumber *responseSizeLimitOverride;
- (nullable instancetype)init NS_UNAVAILABLE; - (nullable instancetype)init NS_UNAVAILABLE;
/** Host objects initialized with the same address are the same. */ /** Host objects initialized with the same address are the same. */
+ (nullable instancetype)hostWithAddress:(NSString *)address; + (nullable instancetype)hostWithAddress:(NSString *)address;

@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
// TODO(jcanizales): Generate the version in a standalone header, from templates. Like // TODO(jcanizales): Generate the version in a standalone header, from templates. Like
// templates/src/core/surface/version.c.template . // templates/src/core/surface/version.c.template .
#define GRPC_OBJC_VERSION_STRING @"0.13.0" #define GRPC_OBJC_VERSION_STRING @"1.0.0-pre1"
static NSMutableDictionary *kHostCache; static NSMutableDictionary *kHostCache;
@ -113,6 +113,12 @@ static NSMutableDictionary *kHostCache;
} }
} }
+ (void)resetAllHostSettings {
@synchronized (kHostCache) {
kHostCache = [NSMutableDictionary dictionary];
}
}
- (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path - (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path
completionQueue:(GRPCCompletionQueue *)queue { completionQueue:(GRPCCompletionQueue *)queue {
GRPCChannel *channel; GRPCChannel *channel;
@ -209,6 +215,10 @@ static NSMutableDictionary *kHostCache;
if (_secure && _hostNameOverride) { if (_secure && _hostNameOverride) {
args[@GRPC_SSL_TARGET_NAME_OVERRIDE_ARG] = _hostNameOverride; args[@GRPC_SSL_TARGET_NAME_OVERRIDE_ARG] = _hostNameOverride;
} }
if (_responseSizeLimitOverride) {
args[@GRPC_ARG_MAX_MESSAGE_LENGTH] = _responseSizeLimitOverride;
}
return args; return args;
} }

@ -292,15 +292,6 @@ static GRPCProtoMethod *kUnaryCallMethod;
// TODO(makarandd): Move to a different file that contains only unit tests // TODO(makarandd): Move to a different file that contains only unit tests
- (void)testExceptions { - (void)testExceptions {
// Try to set userAgentPrefix for host that is nil. This should cause
// an exception.
@try {
[GRPCCall setUserAgentPrefix:@"Foo" forHost:nil];
XCTFail(@"Did not receive an exception when host is nil");
} @catch(NSException *theException) {
NSLog(@"Received exception as expected: %@", theException.name);
}
// Try to set parameters to nil for GRPCCall. This should cause an exception // Try to set parameters to nil for GRPCCall. This should cause an exception
@try { @try {
(void)[[GRPCCall alloc] initWithHost:nil (void)[[GRPCCall alloc] initWithHost:nil

@ -46,4 +46,11 @@
* Override in a subclass to perform these tests against a specific address. * Override in a subclass to perform these tests against a specific address.
*/ */
+ (NSString *)host; + (NSString *)host;
/**
* Bytes of overhead of test proto responses due to encoding. This is used to excercise the behavior
* when responses are just above or below the max response size. For some reason, the local and
* remote servers enconde responses with different overhead (?), so this is defined per-subclass.
*/
- (int32_t)encodingOverhead;
@end @end

@ -80,10 +80,6 @@
#pragma mark Tests #pragma mark Tests
#ifdef GRPC_COMPILE_WITH_CRONET
static cronet_engine *cronetEngine = NULL;
#endif
@implementation InteropTests { @implementation InteropTests {
RMTTestService *_service; RMTTestService *_service;
} }
@ -92,15 +88,22 @@ static cronet_engine *cronetEngine = NULL;
return nil; return nil;
} }
- (int32_t)encodingOverhead {
return 0;
}
- (void)setUp { - (void)setUp {
self.continueAfterFailure = NO;
[GRPCCall resetHostSettings];
_service = self.class.host ? [RMTTestService serviceWithHost:self.class.host] : nil; _service = self.class.host ? [RMTTestService serviceWithHost:self.class.host] : nil;
#ifdef GRPC_COMPILE_WITH_CRONET #ifdef GRPC_COMPILE_WITH_CRONET
if (cronetEngine == NULL) { if (cronetEngine == NULL) {
// Cronet setup // Cronet setup
[Cronet setHttp2Enabled:YES]; [Cronet setHttp2Enabled:YES];
[Cronet start]; [Cronet start];
cronetEngine = [Cronet getGlobalEngine]; [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]];
[GRPCCall useCronetWithEngine:cronetEngine];
} }
#endif #endif
} }
@ -146,6 +149,64 @@ static cronet_engine *cronetEngine = NULL;
[self waitForExpectationsWithTimeout:16 handler:nil]; [self waitForExpectationsWithTimeout:16 handler:nil];
} }
- (void)test4MBResponsesAreAccepted {
XCTAssertNotNil(self.class.host);
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"MaxResponseSize"];
RMTSimpleRequest *request = [RMTSimpleRequest message];
const int32_t kPayloadSize = 4 * 1024 * 1024 - self.encodingOverhead; // 4MB - encoding overhead
request.responseSize = kPayloadSize;
[_service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
XCTAssertEqual(response.payload.body.length, kPayloadSize);
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:16 handler:nil];
}
- (void)testResponsesOverMaxSizeFailWithActionableMessage {
XCTAssertNotNil(self.class.host);
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ResponseOverMaxSize"];
RMTSimpleRequest *request = [RMTSimpleRequest message];
const int32_t kPayloadSize = 4 * 1024 * 1024 - self.encodingOverhead + 1; // 1B over max size
request.responseSize = kPayloadSize;
[_service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) {
// TODO(jcanizales): Catch the error and rethrow it with an actionable message:
// - Use +[GRPCCall setResponseSizeLimit:forHost:] to set a higher limit.
// - If you're developing the server, consider using response streaming, or let clients filter
// responses by setting a google.protobuf.FieldMask in the request:
// https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto
XCTAssertEqualObjects(error.localizedDescription, @"Max message size exceeded");
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:16 handler:nil];
}
- (void)testResponsesOver4MBAreAcceptedIfOptedIn {
XCTAssertNotNil(self.class.host);
__weak XCTestExpectation *expectation =
[self expectationWithDescription:@"HigherResponseSizeLimit"];
RMTSimpleRequest *request = [RMTSimpleRequest message];
const size_t kPayloadSize = 5 * 1024 * 1024; // 5MB
request.responseSize = kPayloadSize;
[GRPCCall setResponseSizeLimit:6 * 1024 * 1024 forHost:self.class.host];
[_service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
XCTAssertEqual(response.payload.body.length, kPayloadSize);
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:16 handler:nil];
}
- (void)testClientStreamingRPC { - (void)testClientStreamingRPC {
XCTAssertNotNil(self.class.host); XCTAssertNotNil(self.class.host);
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ClientStreaming"]; __weak XCTestExpectation *expectation = [self expectationWithDescription:@"ClientStreaming"];

@ -47,11 +47,15 @@ static NSString * const kLocalCleartextHost = @"localhost:5050";
return kLocalCleartextHost; return kLocalCleartextHost;
} }
- (int32_t)encodingOverhead {
return 10; // bytes
}
- (void)setUp { - (void)setUp {
[super setUp];
// Register test server as non-SSL. // Register test server as non-SSL.
[GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost]; [GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost];
[super setUp];
} }
@end @end

@ -47,14 +47,18 @@ static NSString * const kLocalSSLHost = @"localhost:5051";
return kLocalSSLHost; return kLocalSSLHost;
} }
- (int32_t)encodingOverhead {
return 10; // bytes
}
- (void)setUp { - (void)setUp {
[super setUp];
// Register test server certificates and name. // Register test server certificates and name.
NSBundle *bundle = [NSBundle bundleForClass:self.class]; NSBundle *bundle = [NSBundle bundleForClass:self.class];
NSString *certsPath = [bundle pathForResource:@"TestCertificates.bundle/test-certificates" NSString *certsPath = [bundle pathForResource:@"TestCertificates.bundle/test-certificates"
ofType:@"pem"]; ofType:@"pem"];
[GRPCCall useTestCertsPath:certsPath testName:@"foo.test.google.fr" forHost:kLocalSSLHost]; [GRPCCall useTestCertsPath:certsPath testName:@"foo.test.google.fr" forHost:kLocalSSLHost];
[super setUp];
} }
- (void)testExceptions { - (void)testExceptions {

@ -47,4 +47,8 @@ static NSString * const kRemoteSSLHost = @"grpc-test.sandbox.googleapis.com";
return kRemoteSSLHost; return kRemoteSSLHost;
} }
- (int32_t)encodingOverhead {
return 12; // bytes
}
@end @end

@ -38,12 +38,6 @@
ReferencedContainer = "container:Tests.xcodeproj"> ReferencedContainer = "container:Tests.xcodeproj">
</BuildableReference> </BuildableReference>
<SkippedTests> <SkippedTests>
<Test
Identifier = "GRPCClientTests/testConnectionToRemoteServer">
</Test>
<Test
Identifier = "GRPCClientTests/testMetadata">
</Test>
<Test <Test
Identifier = "InteropTests"> Identifier = "InteropTests">
</Test> </Test>

@ -34,9 +34,9 @@
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027", "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.5.0-rc2-24027", "NETStandard.Library": "1.6.0",
"System.Threading.Tasks": "4.0.11-rc2-24027" "System.Threading.Tasks": "4.0.11"
} }
} }
} }

@ -15,12 +15,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
}, },

@ -42,8 +42,8 @@
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027", "NETStandard.Library": "1.6.0",
"System.Threading.Thread": "4.0.0-rc2-24027" "System.Threading.Thread": "4.0.0"
} }
} }
} }

@ -9,12 +9,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -9,12 +9,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -11,12 +11,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -20,7 +20,7 @@
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "NETStandard.Library": "1.6.0"
} }
} }
} }

@ -11,12 +11,13 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -39,7 +39,7 @@
"portable-net45" "portable-net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "NETStandard.Library": "1.6.0"
} }
} }
} }

@ -9,13 +9,14 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -9,13 +9,14 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -9,13 +9,14 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -9,13 +9,14 @@
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "Microsoft.NETCore.App": "1.0.0",
"NETStandard.Library": "1.6.0"
} }
} }
} }

@ -24,14 +24,15 @@
"System.IO": "" "System.IO": ""
} }
}, },
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"portable-net45", "portable-net45",
"net45" "net45"
], ],
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027", "Microsoft.NETCore.App": "1.0.0",
"System.Linq.Expressions": "4.0.11-rc2-24027" "NETStandard.Library": "1.6.0",
"System.Linq.Expressions": "4.1.0"
} }
} }
} }

@ -35,4 +35,4 @@ cd $(dirname $0)/../../src/csharp
# TODO(jtattermusch): introduce caching # TODO(jtattermusch): introduce caching
dotnet restore . dotnet restore .
dotnet build -f netstandard1.5 --configuration $MSBUILD_CONFIG '**/project.json' dotnet build --configuration $MSBUILD_CONFIG '**/project.json'

@ -49,7 +49,12 @@ cp grpc-*.tgz $artifacts/grpc.tgz
mkdir -p bin mkdir -p bin
cd src/node/tools cd $base/src/node/health_check
npm update
npm pack
cp grpc-health-check-*.tgz $artifacts/
cd $base/src/node/tools
npm update npm update
npm pack npm pack
cp grpc-tools-*.tgz $artifacts/ cp grpc-tools-*.tgz $artifacts/

Loading…
Cancel
Save