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

Function TEST

src/tests/protobuf_utils_tests.cpp:49–73  ·  view source on GitHub ↗

This tests that helper function `getRoles` can correctly get roles from multi-role FrameworkInfo and role from single-role FrameworkInfo.

Source from the content-addressed store, hash-verified

47// get roles from multi-role FrameworkInfo and role from
48// single-role FrameworkInfo.
49TEST(ProtobufUtilTest, GetRoles)
50{
51 // Get roles from a multi-role framework.
52 {
53 FrameworkInfo frameworkInfo;
54 frameworkInfo.add_capabilities()->set_type(
55 FrameworkInfo::Capability::MULTI_ROLE);
56 frameworkInfo.add_roles("bar");
57 frameworkInfo.add_roles("qux");
58
59 set<string> roles = protobuf::framework::getRoles(frameworkInfo);
60
61 EXPECT_EQ(roles, set<string>({"qux", "bar"}));
62 }
63
64 // Get role from a single-role framework.
65 {
66 FrameworkInfo frameworkInfo;
67 frameworkInfo.set_role("foo");
68
69 set<string> roles = protobuf::framework::getRoles(frameworkInfo);
70
71 EXPECT_EQ(roles, set<string>({"foo"}));
72 }
73}
74
75
76// Tests that allocation info can be injected to and stripped from

Callers

nothing calls this directly

Calls 15

getRolesFunction · 0.85
injectAllocationInfoFunction · 0.85
stripAllocationInfoFunction · 0.85
LAUNCH_GROUPFunction · 0.85
RESERVEFunction · 0.85
UNRESERVEFunction · 0.85
createLabelFunction · 0.85
convertLabelsToStringMapFunction · 0.85
convertStringMapToLabelsFunction · 0.85
NoneClass · 0.85
BytesClass · 0.85
MegabytesFunction · 0.85

Tested by

no test coverage detected