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

Function foreachpair

src/tests/master_load_tests.cpp:390–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388 {descriptor1, descriptor2, descriptor3, descriptor4, descriptor5});
389
390 foreachpair (
391 const RequestDescriptor& request,
392 Future<Response>& response,
393 responses)
394 {
395 AWAIT_READY(response);
396
397 mesos::internal::master::Master* master = master_->master.get();
398 mesos::internal::master::Master::ReadOnlyHandler readOnlyHandler(master);
399
400 // TODO(bevers): Ideally we would not use HTTP at all to generate
401 // the reference response, but some master-internal function
402 // like `model(Summary<Master>)`.
403 Try<hashmap<std::string, std::string>> queryParameters_ =
404 process::http::query::decode(request.query);
405
406 ASSERT_SOME(queryParameters_);
407 hashmap<std::string, std::string> queryParameters = queryParameters_.get();
408
409 process::http::authentication::Principal principal(request.principal);
410 MockAuthorizer authorizer;
411 Owned<ObjectApprovers> approvers = ObjectApprovers::create(
412 &authorizer,
413 principal,
414 {VIEW_ROLE, VIEW_FLAGS, VIEW_FRAMEWORK, VIEW_TASK, VIEW_EXECUTOR})
415 .get();
416
417 Response reference;
418 if (request.endpoint == "/state") {
419 reference = readOnlyHandler.state(
420 ContentType::JSON, queryParameters, approvers).first;
421 } else if (request.endpoint == "/state-summary") {
422 reference = readOnlyHandler.stateSummary(
423 ContentType::JSON, queryParameters, approvers).first;
424 } else if (request.endpoint == "/roles") {
425 reference = readOnlyHandler.roles(
426 ContentType::JSON, queryParameters, approvers).first;
427 } else if (request.endpoint == "/frameworks") {
428 reference = readOnlyHandler.frameworks(
429 ContentType::JSON, queryParameters, approvers).first;
430 } else if (request.endpoint == "/slaves") {
431 reference = readOnlyHandler.slaves(
432 ContentType::JSON, queryParameters, approvers).first;
433 } else {
434 UNREACHABLE();
435 }
436
437 EXPECT_EQ(reference.body, response->body);
438 }
439
440 // Ensure that we actually hit the metrics code path while executing
441 // the test.

Callers

nothing calls this directly

Calls 12

principalMethod · 0.80
decodeFunction · 0.50
createFunction · 0.50
parseFunction · 0.50
containsFunction · 0.50
getMethod · 0.45
stateMethod · 0.45
stateSummaryMethod · 0.45
rolesMethod · 0.45
frameworksMethod · 0.45
slavesMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected