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
dbfe2f43
Commit
dbfe2f43
authored
9 years ago
by
murgatroid99
Browse files
Options
Downloads
Patches
Plain Diff
Added cancel_after_first_response test
parent
a42c1fe8
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
+33
-0
33 additions, 0 deletions
...bjective-c/examples/Sample/SampleTests/RemoteProtoTests.m
with
33 additions
and
0 deletions
src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
+
33
−
0
View file @
dbfe2f43
...
...
@@ -269,4 +269,37 @@
[
self
waitForExpectationsWithTimeout
:
1
handler
:
nil
];
}
-
(
void
)
testCancelAfterFirstResponseRPC
{
__weak
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
@"CancelAfterFirstResponse"
];
// A buffered pipe to which we never write any value acts as a writer that just hangs.
GRXBufferedPipe
*
requestsBuffer
=
[[
GRXBufferedPipe
alloc
]
init
];
__block
bool
receivedResponse
=
false
;
id
request
=
[
RMTStreamingOutputCallRequest
messageWithPayloadSize
:
@21782
requestedResponseSize:
@31415
];
[
requestsBuffer
writeValue
:
request
];
__block
ProtoRPC
*
call
=
[
_service
RPCToFullDuplexCallWithRequestsWriter
:
requestsBuffer
handler:
^
(
BOOL
done
,
RMTStreamingOutputCallResponse
*
response
,
NSError
*
error
)
{
if
(
receivedResponse
)
{
XCTAssert
(
done
,
@"Unexpected extra response %@"
,
response
);
XCTAssertEqual
(
error
.
code
,
GRPC_STATUS_CANCELLED
);
[
expectation
fulfill
];
}
else
{
XCTAssertNil
(
error
,
@"Finished with unexpected error: %@"
,
error
);
XCTAssertFalse
(
done
,
@"Finished without response"
);
XCTAssertNotNil
(
response
);
receivedResponse
=
true
;
[
call
cancel
];
}
}];
[
call
start
];
[
self
waitForExpectationsWithTimeout
:
4
handler
:
nil
];
}
@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