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

Method getDiskResource

src/tests/persistent_volume_tests.cpp:213–253  ·  view source on GitHub ↗

Creates a disk with / without a `source` based on the parameterization of the test. `id` influences the `root` if one is specified so that we can create multiple disks in the tests.

Source from the content-addressed store, hash-verified

211 // parameterization of the test. `id` influences the `root` if one
212 // is specified so that we can create multiple disks in the tests.
213 Resource getDiskResource(const Bytes& mb, size_t id = 1)
214 {
215 CHECK_LE(1u, id);
216 CHECK_GE(NUM_DISKS, id);
217 Resource diskResource;
218
219 switch (GetParam()) {
220 case NONE: {
221 diskResource = createDiskResource(
222 stringify((double) mb.bytes() / Bytes::MEGABYTES),
223 DEFAULT_TEST_ROLE,
224 None(),
225 None());
226
227 break;
228 }
229 case PATH: {
230 diskResource = createDiskResource(
231 stringify((double) mb.bytes() / Bytes::MEGABYTES),
232 DEFAULT_TEST_ROLE,
233 None(),
234 None(),
235 createDiskSourcePath(path::join(diskPath, "disk" + stringify(id))));
236
237 break;
238 }
239 case MOUNT: {
240 diskResource = createDiskResource(
241 stringify((double) mb.bytes() / Bytes::MEGABYTES),
242 DEFAULT_TEST_ROLE,
243 None(),
244 None(),
245 createDiskSourceMount(
246 path::join(diskPath, "disk" + stringify(id))));
247
248 break;
249 }
250 }
251
252 return diskResource;
253 }
254
255 string getSlaveResources()
256 {

Callers

nothing calls this directly

Calls 7

createDiskResourceFunction · 0.85
NoneClass · 0.85
createDiskSourcePathFunction · 0.85
createDiskSourceMountFunction · 0.85
stringifyFunction · 0.50
joinFunction · 0.50
bytesMethod · 0.45

Tested by

no test coverage detected