Merge pull request #5311 from vjpai/qa
Add a test for immediate and historic alarms
This commit is contained in:
commit
27b3f776da
|
|
@ -55,6 +55,36 @@ TEST(AlarmTest, RegularExpiry) {
|
|||
EXPECT_EQ(junk, output_tag);
|
||||
}
|
||||
|
||||
TEST(AlarmTest, ZeroExpiry) {
|
||||
CompletionQueue cq;
|
||||
void* junk = reinterpret_cast<void*>(1618033);
|
||||
Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(0), junk);
|
||||
|
||||
void* output_tag;
|
||||
bool ok;
|
||||
const CompletionQueue::NextStatus status = cq.AsyncNext(
|
||||
(void**)&output_tag, &ok, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(0));
|
||||
|
||||
EXPECT_EQ(status, CompletionQueue::GOT_EVENT);
|
||||
EXPECT_TRUE(ok);
|
||||
EXPECT_EQ(junk, output_tag);
|
||||
}
|
||||
|
||||
TEST(AlarmTest, NegativeExpiry) {
|
||||
CompletionQueue cq;
|
||||
void* junk = reinterpret_cast<void*>(1618033);
|
||||
Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(-1), junk);
|
||||
|
||||
void* output_tag;
|
||||
bool ok;
|
||||
const CompletionQueue::NextStatus status = cq.AsyncNext(
|
||||
(void**)&output_tag, &ok, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(0));
|
||||
|
||||
EXPECT_EQ(status, CompletionQueue::GOT_EVENT);
|
||||
EXPECT_TRUE(ok);
|
||||
EXPECT_EQ(junk, output_tag);
|
||||
}
|
||||
|
||||
TEST(AlarmTest, Cancellation) {
|
||||
CompletionQueue cq;
|
||||
void* junk = reinterpret_cast<void*>(1618033);
|
||||
|
|
|
|||
Loading…
Reference in New Issue