Warning and control the rest of interfaces in GRPCCall+Tests as well

pull/9247/head
Muxi Yan 8 years ago
parent 5bd16b7013
commit 14c76cf2c9
  1. 9
      src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.h
  2. 18
      src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.m

@ -45,6 +45,9 @@
*
* Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
* more than one invocation of the methods of this category.
*
* This function is for internal testing of gRPC only. It is not part of gRPC's public interface.
* Do not use in production. To enable, set the preprocessor flag GRPC_TEST_OBJC.
*/
+ (void)useTestCertsPath:(NSString *)certsPath
testName:(NSString *)testName
@ -55,12 +58,18 @@
*
* Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
* more than one invocation of the methods of this category.
*
* This function is for internal testing of gRPC only. It is not part of gRPC's public interface.
* Do not use in production. To enable, set the preprocessor flag GRPC_TEST_OBJC.
*/
+ (void)useInsecureConnectionsForHost:(NSString *)host;
/**
* Resets all host configurations to their default values, and flushes all connections from the
* cache.
*
* This function is for internal testing of gRPC only. It is not part of gRPC's public interface.
* Do not use in production. To enable, set the preprocessor flag GRPC_TEST_OBJC.
*/
+ (void)resetHostSettings;

@ -41,6 +41,7 @@
+ (void)useTestCertsPath:(NSString *)certsPath
testName:(NSString *)testName
forHost:(NSString *)host {
#ifdef GRPC_TEST_OBJC
if (!host || !certsPath || !testName) {
[NSException raise:NSInvalidArgumentException format:@"host, path and name must be provided."];
}
@ -55,15 +56,32 @@
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
[hostConfig setTLSPEMRootCerts:certs withPrivateKey:nil withCertChain:nil error:nil];
hostConfig.hostNameOverride = testName;
#else
NSLog(@"This function is for internal testing of gRPC only. "
"It is not part of gRPC's public interface. Do not use in production. "
"To enable, set the preprocessor flag GRPC_TEST_OBJC.");
#endif
}
+ (void)useInsecureConnectionsForHost:(NSString *)host {
#ifdef GRPC_TEST_OBJC
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
hostConfig.secure = NO;
#else
NSLog(@"This function is for internal testing of gRPC only. "
"It is not part of gRPC's public interface. Do not use in production. "
"To enable, set the preprocessor flag GRPC_TEST_OBJC.");
#endif
}
+ (void)resetHostSettings {
#ifdef GRPC_TEST_OBJC
[GRPCHost resetAllHostSettings];
#else
NSLog(@"This function is for internal testing of gRPC only. "
"It is not part of gRPC's public interface. Do not use in production. "
"To enable, set the preprocessor flag GRPC_TEST_OBJC.");
#endif
}
+ (void)enableOpBatchLog:(BOOL)enabled {

Loading…
Cancel
Save