MCPcopy Create free account
hub / github.com/apache/mesos / TEST

Function TEST

3rdparty/libprocess/src/tests/sequence_tests.cpp:68–100  ·  view source on GitHub ↗

The test verifies that callbacks are properly serialized by the Sequence object.

Source from the content-addressed store, hash-verified

66// The test verifies that callbacks are properly serialized by the
67// Sequence object.
68TEST(SequenceTest, Serialize)
69{
70 TestProcess process;
71 spawn(process);
72
73 Sequence sequence;
74
75 Future<Nothing> bar = FUTURE_DISPATCH(_, &TestProcess::bar);
76
77 lambda::function<Future<Nothing>()> f;
78
79 f = defer(process, &TestProcess::foo);
80 sequence.add(f);
81
82 f = defer(process, &TestProcess::bar);
83 sequence.add(f);
84
85 // Flush the event queue to make sure that if the method 'bar' could
86 // have been invoked, the future 'bar' would be satisfied before the
87 // pending check below.
88 Clock::pause();
89 Clock::settle();
90 Clock::resume();
91
92 EXPECT_TRUE(bar.isPending());
93
94 process.promise.set(Nothing());
95
96 AWAIT_READY(bar);
97
98 terminate(process);
99 wait(process);
100}
101
102
103// Used to verify the discard semantics of Sequence.

Callers

nothing calls this directly

Calls 11

deferFunction · 0.85
NothingClass · 0.85
randomFunction · 0.85
spawnFunction · 0.50
terminateFunction · 0.50
waitFunction · 0.50
addMethod · 0.45
isPendingMethod · 0.45
setMethod · 0.45
discardMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected