Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
c48f26f5
Commit
c48f26f5
authored
9 years ago
by
Michael Lumish
Browse files
Options
Downloads
Plain Diff
Merge pull request #1399 from jcanizales/first-objc-integration-tests
First objc integration tests
parents
f394616f
c55a0ca9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/objective-c/examples/Sample/Podfile.lock
+0
-44
0 additions, 44 deletions
src/objective-c/examples/Sample/Podfile.lock
src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
+66
-23
66 additions, 23 deletions
...bjective-c/examples/Sample/SampleTests/RemoteProtoTests.m
with
66 additions
and
67 deletions
src/objective-c/examples/Sample/Podfile.lock
deleted
100644 → 0
+
0
−
44
View file @
f394616f
PODS:
- gRPC (0.0.1):
- gRPC/C-Core (= 0.0.1)
- gRPC/GRPCClient (= 0.0.1)
- gRPC/ProtoRPC (= 0.0.1)
- gRPC/RxLibrary (= 0.0.1)
- gRPC/C-Core (0.0.1):
- OpenSSL (~> 1.0.200)
- gRPC/GRPCClient (0.0.1):
- gRPC/C-Core
- gRPC/RxLibrary
- gRPC/ProtoRPC (0.0.1):
- gRPC/GRPCClient
- gRPC/RxLibrary
- gRPC/RxLibrary (0.0.1)
- OpenSSL (1.0.201)
- ProtocolBuffers (1.9.8)
- RemoteTest (0.0.1):
- gRPC (~> 0.0)
- ProtocolBuffers (~> 1.9)
- Route_guide (0.0.1):
- ProtocolBuffers (~> 1.9)
DEPENDENCIES:
- gRPC (from `../../../..`)
- RemoteTest (from `RemoteTestClient`)
- Route_guide (from `RouteGuideClient`)
EXTERNAL SOURCES:
gRPC:
:path: ../../../..
RemoteTest:
:path: RemoteTestClient
Route_guide:
:path: RouteGuideClient
SPEC CHECKSUMS:
gRPC: f6c1bf5dde59ab543e4bd1d5e2ea56da4a9a0253
OpenSSL: 4e990d04b14015c49c800c400b86ae44a4818a5c
ProtocolBuffers: 9a4a171c0c7cc8f21dd29aeca4f9ac775d84a880
RemoteTest: 021a51c04d5795f286b379ca5ef14d0be5b2fb9b
Route_guide: a277da8eef182774abb050d7b81109f5878f8652
COCOAPODS: 0.36.0
This diff is collapsed.
Click to expand it.
src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
+
66
−
23
View file @
c48f26f5
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import <XCTest/XCTest.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <RemoteTest/Messages.pb.h>
#import <RemoteTest/Messages.pb.h>
#import <RemoteTest/Test.pb.h>
#import <RemoteTest/Test.pb.h>
...
@@ -48,43 +49,85 @@
...
@@ -48,43 +49,85 @@
_service
=
[[
RMTTestService
alloc
]
initWithHost
:
@"grpc-test.sandbox.google.com"
];
_service
=
[[
RMTTestService
alloc
]
initWithHost
:
@"grpc-test.sandbox.google.com"
];
}
}
-
(
void
)
testEmptyRPC
{
// Tests as described here: https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md
__weak
XCTestExpectation
*
noRPCError
=
[
self
expectationWithDescription
:
@"RPC succeeded."
];
__weak
XCTestExpectation
*
responded
=
[
self
expectationWithDescription
:
@"Response received."
];
[
_service
emptyCallWithRequest
:[
RMTEmpty
defaultInstance
]
-
(
void
)
testEmptyUnaryRPC
{
handler:
^
(
RMTEmpty
*
response
,
NSError
*
error
)
{
__weak
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
@"EmptyUnary"
];
RMTEmpty
*
request
=
[
RMTEmpty
defaultInstance
];
[
_service
emptyCallWithRequest
:
request
handler
:
^
(
RMTEmpty
*
response
,
NSError
*
error
)
{
XCTAssertNil
(
error
,
@"Finished with unexpected error: %@"
,
error
);
XCTAssertNil
(
error
,
@"Finished with unexpected error: %@"
,
error
);
[
noRPCError
fulfill
];
XCTAssertNotNil
(
response
,
@"nil response received."
);
id
expectedResponse
=
[
RMTEmpty
defaultInstance
];
[
responded
fulfill
];
XCTAssertEqualObjects
(
response
,
expectedResponse
);
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
2
.
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
2
.
handler
:
nil
];
}
}
-
(
void
)
testSimpleProtoRPC
{
-
(
void
)
testLargeUnaryRPC
{
__weak
XCTestExpectation
*
noRPCError
=
[
self
expectationWithDescription
:
@"RPC succeeded."
];
__weak
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
@"EmptyUnary"
];
__weak
XCTestExpectation
*
responded
=
[
self
expectationWithDescription
:
@"Response received."
];
__weak
XCTestExpectation
*
validResponse
=
[
self
expectationWithDescription
:
@"Valid response."
];
RMTSimpleRequest
*
request
=
[[[[[[
RMTSimpleRequestBuilder
alloc
]
init
]
RMTSimpleRequest
*
request
=
[[[[[[
RMTSimpleRequestBuilder
alloc
]
init
]
setResponseSize:
100
]
setResponseType:
RMTPayloadTypeCompressable
]
setFillUsername:
YES
]
setResponseSize:
314159
]
setFillOauthScope:
YES
]
setPayloadBuilder:
[[[
RMTPayloadBuilder
alloc
]
init
]
setBody:
[
NSMutableData
dataWithLength
:
271828
]]]
build
];
build
];
[
_service
unaryCallWithRequest
:
request
handler
:
^
(
RMTSimpleResponse
*
response
,
NSError
*
error
)
{
[
_service
unaryCallWithRequest
:
request
handler
:
^
(
RMTSimpleResponse
*
response
,
NSError
*
error
)
{
XCTAssertNil
(
error
,
@"Finished with unexpected error: %@"
,
error
);
XCTAssertNil
(
error
,
@"Finished with unexpected error: %@"
,
error
);
[
noRPCError
fulfill
];
XCTAssertNotNil
(
response
,
@"nil response received."
);
id
expectedResponse
=
[[[[
RMTSimpleResponseBuilder
alloc
]
init
]
[
responded
fulfill
];
setPayloadBuilder:
[[[[
RMTPayloadBuilder
alloc
]
init
]
// We expect empty strings, not nil:
setType:
RMTPayloadTypeCompressable
]
XCTAssertNotNil
(
response
.
username
,
@"Response's username is nil."
);
setBody:
[
NSMutableData
dataWithLength
:
314159
]]]
XCTAssertNotNil
(
response
.
oauthScope
,
@"Response's OAuth scope is nil."
);
build
];
[
validResponse
fulfill
];
XCTAssertEqualObjects
(
response
,
expectedResponse
);
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
2
.
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
4
.
handler
:
nil
];
}
-
(
void
)
testClientStreamingRPC
{
__weak
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
@"EmptyUnary"
];
id
request1
=
[[[[
RMTStreamingInputCallRequestBuilder
alloc
]
init
]
setPayloadBuilder:
[[[
RMTPayloadBuilder
alloc
]
init
]
setBody:
[
NSMutableData
dataWithLength
:
27182
]]]
build
];
id
request2
=
[[[[
RMTStreamingInputCallRequestBuilder
alloc
]
init
]
setPayloadBuilder:
[[[
RMTPayloadBuilder
alloc
]
init
]
setBody:
[
NSMutableData
dataWithLength
:
8
]]]
build
];
id
request3
=
[[[[
RMTStreamingInputCallRequestBuilder
alloc
]
init
]
setPayloadBuilder:
[[[
RMTPayloadBuilder
alloc
]
init
]
setBody:
[
NSMutableData
dataWithLength
:
1828
]]]
build
];
id
request4
=
[[[[
RMTStreamingInputCallRequestBuilder
alloc
]
init
]
setPayloadBuilder:
[[[
RMTPayloadBuilder
alloc
]
init
]
setBody:
[
NSMutableData
dataWithLength
:
45904
]]]
build
];
id
<
GRXWriter
>
writer
=
[
GRXWriter
writerWithContainer
:@[
request1
,
request2
,
request3
,
request4
]];
[
_service
streamingInputCallWithRequestsWriter
:
writer
handler:
^
(
RMTStreamingInputCallResponse
*
response
,
NSError
*
error
)
{
XCTAssertNil
(
error
,
@"Finished with unexpected error: %@"
,
error
);
id
expectedResponse
=
[[[[
RMTStreamingInputCallResponseBuilder
alloc
]
init
]
setAggregatedPayloadSize:
74922
]
build
];
XCTAssertEqualObjects
(
response
,
expectedResponse
);
[
expectation
fulfill
];
}];
[
self
waitForExpectationsWithTimeout
:
4
.
handler
:
nil
];
}
}
@end
@end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment