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.
| 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 | { |
nothing calls this directly
no test coverage detected