This tests that helper function `getRoles` can correctly get roles from multi-role FrameworkInfo and role from single-role FrameworkInfo.
| 47 | // get roles from multi-role FrameworkInfo and role from |
| 48 | // single-role FrameworkInfo. |
| 49 | TEST(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 |
nothing calls this directly
no test coverage detected