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

Function TEST_F

src/tests/log_tests.cpp:332–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330
331
332TEST_F(ReplicaTest, Promise)
333{
334 const string path = os::getcwd() + "/.log";
335 initializer.flags.path = path;
336 ASSERT_SOME(initializer.execute());
337
338 Replica replica(path);
339
340 PromiseRequest request;
341 request.set_proposal(2);
342
343 Future<PromiseResponse> response =
344 protocol::promise(replica.pid(), request);
345
346 AWAIT_READY(response);
347
348 EXPECT_EQ(PromiseResponse::ACCEPT, response->type());
349 EXPECT_TRUE(response->okay());
350 EXPECT_EQ(2u, response->proposal());
351 EXPECT_TRUE(response->has_position());
352 EXPECT_EQ(0u, response->position());
353 EXPECT_FALSE(response->has_action());
354
355 request.set_proposal(1);
356
357 response = protocol::promise(replica.pid(), request);
358
359 AWAIT_READY(response);
360
361 EXPECT_EQ(PromiseResponse::REJECT, response->type());
362 EXPECT_FALSE(response->okay());
363 EXPECT_EQ(2u, response->proposal()); // Highest proposal seen so far.
364 EXPECT_FALSE(response->has_position());
365 EXPECT_FALSE(response->has_action());
366
367 request.set_proposal(3);
368
369 response = protocol::promise(replica.pid(), request);
370
371 AWAIT_READY(response);
372
373 EXPECT_EQ(PromiseResponse::ACCEPT, response->type());
374 EXPECT_TRUE(response->okay());
375 EXPECT_EQ(3u, response->proposal());
376 EXPECT_TRUE(response->has_position());
377 EXPECT_EQ(0u, response->position());
378 EXPECT_FALSE(response->has_action());
379}
380
381
382TEST_F(ReplicaTest, Append)

Callers

nothing calls this directly

Calls 15

promiseFunction · 0.85
SecondsClass · 0.85
InvokeClass · 0.85
FutureSatisfyFunction · 0.85
catchupFunction · 0.85
NoneClass · 0.85
typeMethod · 0.80
promisedMethod · 0.80
insertMethod · 0.80
electMethod · 0.80
failureMethod · 0.80
shareMethod · 0.80

Tested by

no test coverage detected