forked from grpc/grpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gRPC/iOS] Introduce common test util for reading interop server addr (…
- Loading branch information
Showing
13 changed files
with
156 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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 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,20 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'Common' | ||
s.version = "0.0.1" | ||
s.license = "Apache License, Version 2.0" | ||
s.authors = { 'gRPC contributors' => '[email protected]' } | ||
s.homepage = "https://grpc.io/" | ||
s.summary = "Shared common test utils" | ||
s.source = { :git => 'https://github.com/grpc/grpc.git' } | ||
|
||
s.ios.deployment_target = '9.0' | ||
s.osx.deployment_target = '10.10' | ||
s.tvos.deployment_target = '10.0' | ||
s.watchos.deployment_target = '4.0' | ||
s.framework = 'XCTest' | ||
|
||
s.dependency "gRPC-ProtoRPC" | ||
|
||
s.source_files = '**/*.{m}' | ||
s.public_header_files = '**/*.{h}' | ||
end |
File renamed without changes.
File renamed without changes.
This file contains 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,44 @@ | ||
/* | ||
* | ||
* Copyright 2019 gRPC authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* Common utility to fetch plain text local interop server address. | ||
* | ||
* @return Interop test server address including host and port. | ||
*/ | ||
FOUNDATION_EXPORT NSString *GRPCGetLocalInteropTestServerAddressPlainText(void); | ||
|
||
/** | ||
* Common utility to fetch ssl local interop server address. | ||
* | ||
* @return Interop test server address including host and port. | ||
*/ | ||
FOUNDATION_EXPORT NSString *GRPCGetLocalInteropTestServerAddressSSL(void); | ||
|
||
/** | ||
* Common utility to fetch remote interop test server address. | ||
* | ||
* @return Interop test server address including host and port. | ||
*/ | ||
FOUNDATION_EXPORT NSString *GRPCGetRemoteInteropTestServerAddress(void); | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains 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,51 @@ | ||
/** | ||
* Copyright 2022 gRPC authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#import "TestUtils.h" | ||
|
||
// Utility macro to stringize preprocessor defines | ||
#define NSStringize_helper(x) #x | ||
#define NSStringize(x) @NSStringize_helper(x) | ||
|
||
NSString *GRPCGetLocalInteropTestServerAddressPlainText() { | ||
static NSString *address; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
address = | ||
[NSProcessInfo processInfo].environment[@"HOST_PORT_LOCAL"] ?: NSStringize(HOST_PORT_LOCAL); | ||
}); | ||
return address; | ||
} | ||
|
||
NSString *GRPCGetLocalInteropTestServerAddressSSL() { | ||
static NSString *address; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
address = [NSProcessInfo processInfo].environment[@"HOST_PORT_LOCALSSL"] | ||
?: NSStringize(HOST_PORT_LOCALSSL); | ||
}); | ||
return address; | ||
} | ||
|
||
NSString *GRPCGetRemoteInteropTestServerAddress() { | ||
static NSString *address; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
address = [NSProcessInfo processInfo].environment[@"HOST_PORT_REMOTE"] | ||
?: NSStringize(HOST_PORT_REMOTE); | ||
}); | ||
return address; | ||
} |
This file contains 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 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 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 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 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 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
Oops, something went wrong.