MCPcopy Create free account
hub / github.com/ceph/ceph / TEST

Function TEST

src/dmclock/test/test_dmclock_server.cc:51–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51 TEST(dmclock_server, bad_tag_deathtest) {
52 using ClientId = int;
53 using Queue = dmc::PullPriorityQueue<ClientId,Request,true>;
54 using QueueRef = std::unique_ptr<Queue>;
55
56 ClientId client1 = 17;
57 ClientId client2 = 18;
58
59 double reservation = 0.0;
60 double weight = 0.0;
61
62 dmc::ClientInfo ci1(reservation, weight, 0.0);
63 dmc::ClientInfo ci2(reservation, weight, 1.0);
64
65 auto client_info_f = [&] (ClientId c) -> const dmc::ClientInfo* {
66 if (client1 == c) return &ci1;
67 else if (client2 == c) return &ci2;
68 else {
69 ADD_FAILURE() << "got request from neither of two clients";
70 return nullptr;
71 }
72 };
73
74 QueueRef pq(new Queue(client_info_f, AtLimit::Wait));
75 ReqParams req_params(1,1);
76
77 // Disable coredumps
78 PrCtl unset_dumpable;
79
80 EXPECT_DEATH_IF_SUPPORTED(pq->add_request(Request{}, client1, req_params),
81 "Assertion.*reservation.*max_tag.*"
82 "proportion.*max_tag") <<
83 "we should fail if a client tries to generate a reservation tag "
84 "where reservation and proportion are both 0";
85
86
87 EXPECT_DEATH_IF_SUPPORTED(pq->add_request(Request{}, client2, req_params),
88 "Assertion.*reservation.*max_tag.*"
89 "proportion.*max_tag") <<
90 "we should fail if a client tries to generate a reservation tag "
91 "where reservation and proportion are both 0";
92
93 EXPECT_DEATH_IF_SUPPORTED(Queue(client_info_f, AtLimit::Reject),
94 "Assertion.*Reject.*Delayed") <<
95 "we should fail if a client tries to construct a queue with both "
96 "DelayedTagCalc and AtLimit::Reject";
97 }
98
99
100 TEST(dmclock_server, client_idle_erase) {

Callers

nothing calls this directly

Calls 15

QueueClass · 0.85
MyReqClass · 0.85
ClientInfoClass · 0.85
run_testFunction · 0.85
is_retnMethod · 0.80
is_futureMethod · 0.80
getTimeMethod · 0.80
client_countMethod · 0.80
remove_by_clientMethod · 0.80
update_client_infoMethod · 0.80
test_lockedFunction · 0.70
get_timeFunction · 0.50

Tested by

no test coverage detected