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

Function changeAllMutableFields

src/tests/master/update_framework_tests.cpp:89–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87
88template <class TFrameworkInfo>
89static TFrameworkInfo changeAllMutableFields(const TFrameworkInfo& oldInfo)
90{
91 CHECK_EQ(TFrameworkInfo::descriptor()->field_count(), 13)
92 << "After adding a new mutable field to FrameworkInfo, please make sure "
93 << "that this function modifies this field";
94
95 TFrameworkInfo newInfo = oldInfo;
96
97 *newInfo.mutable_name() += "_foo";
98 newInfo.set_failover_timeout(newInfo.failover_timeout() + 1000.0);
99 *newInfo.mutable_hostname() += ".foo";
100 *newInfo.mutable_webui_url() += "/foo";
101
102 newInfo.add_capabilities()->set_type(
103 TFrameworkInfo::Capability::REGION_AWARE);
104
105 auto* newLabel = newInfo.mutable_labels()->add_labels();
106 *newLabel->mutable_key() = "UPDATE_FRAMEWORK_KEY";
107 *newLabel->mutable_value() = "UPDATE_FRAMEWORK_VALUE";
108
109 // TODO(asekretenko): Test update of `role` with a non-MULTI_ROLE framework.
110 newInfo.add_roles("new_role");
111
112 CHECK(newInfo.offer_filters().count("new_role") == 0);
113 (*newInfo.mutable_offer_filters())["new_role"] =
114 typename std::remove_reference<decltype(
115 newInfo.offer_filters())>::type::mapped_type();
116
117 return newInfo;
118}
119
120namespace v1 {
121

Callers 1

TEST_FFunction · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected