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

Function TEST_F

src/tests/disk_profile_adaptor_tests.cpp:119–171  ·  view source on GitHub ↗

Exercises the disk profile map parsing method with the example found in the UriDiskProfileAdaptor module's help string.

Source from the content-addressed store, hash-verified

117// Exercises the disk profile map parsing method with the example found
118// in the UriDiskProfileAdaptor module's help string.
119TEST_F(UriDiskProfileAdaptorTest, ParseExample)
120{
121 const string example = R"~(
122 {
123 "profile_matrix" : {
124 "my-profile" : {
125 "csi_plugin_type_selector" : {
126 "plugin_type" : "org.apache.mesos.csi.test"
127 },
128 "volume_capabilities" : {
129 "block" : {},
130 "access_mode" : { "mode" : "SINGLE_NODE_WRITER" }
131 },
132 "create_parameters" : {
133 "mesos-does-not" : "interpret-these",
134 "type" : "raid5",
135 "stripes" : "3",
136 "stripesize" : "64"
137 }
138 }
139 }
140 })~";
141
142 Try<DiskProfileMapping> parsed =
143 mesos::internal::storage::parseDiskProfileMapping(example);
144 ASSERT_SOME(parsed);
145
146 const string key = "my-profile";
147 ASSERT_EQ(1u, parsed->profile_matrix().count(key));
148
149 csi::v0::VolumeCapability capability =
150 parsed->profile_matrix().at(key).volume_capabilities();
151
152 ASSERT_TRUE(capability.has_block());
153 ASSERT_TRUE(capability.has_access_mode());
154 ASSERT_EQ(
155 csi::v0::VolumeCapability::AccessMode::SINGLE_NODE_WRITER,
156 capability.access_mode().mode());
157
158 Map<string, string> parameters =
159 parsed->profile_matrix().at(key).create_parameters();
160
161 ASSERT_EQ(4u, parameters.size());
162 ASSERT_EQ(1u, parameters.count("mesos-does-not"));
163 ASSERT_EQ(1u, parameters.count("type"));
164 ASSERT_EQ(1u, parameters.count("stripes"));
165 ASSERT_EQ(1u, parameters.count("stripesize"));
166
167 ASSERT_EQ("interpret-these", parameters.at("mesos-does-not"));
168 ASSERT_EQ("raid5", parameters.at("type"));
169 ASSERT_EQ("3", parameters.at("stripes"));
170 ASSERT_EQ("64", parameters.at("stripesize"));
171}
172
173
174// Exercises the disk profile map parsing method with some slightly incorrect

Callers

nothing calls this directly

Calls 15

parseDiskProfileMappingFunction · 0.85
SecondsClass · 0.85
OKClass · 0.85
FutureSatisfyFunction · 0.85
atMethod · 0.80
insertMethod · 0.80
errorMethod · 0.65
joinFunction · 0.50
stringifyFunction · 0.50
writeFunction · 0.50
createFunction · 0.50
countMethod · 0.45

Tested by

no test coverage detected