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

Function TEST_F

src/tests/containerizer/containerizer_tests.cpp:41–60  ·  view source on GitHub ↗

This test verifies that standard resources (memory, CPU, ports etc) are automatically added if and only if they are not explicitly specified on the command line.

Source from the content-addressed store, hash-verified

39// automatically added if and only if they are not explicitly specified on
40// the command line.
41TEST_F(ContainerizerResourcesTest, AutoResources)
42{
43 slave::Flags flags = CreateSlaveFlags();
44 // Use a resource string that contains the standard resources as
45 // substrings, to make sure they don't accidentally suppress the
46 // automatic values (regression test for MESOS-6821).
47 flags.resources =
48 "my.cpus:1000;cpus-suffix:3;memory(mem):1024"
49 ";things:{mem,disk,ports};diskports:[30000-35000]";
50
51 Try<Resources> resources = Containerizer::resources(flags);
52 ASSERT_SOME(resources);
53
54 EXPECT_LT(0, resources->cpus().getOrElse(0));
55 EXPECT_LT(Bytes(0), resources->mem().getOrElse(0));
56 EXPECT_LT(Bytes(0), resources->disk().getOrElse(0));
57
58 EXPECT_EQ(
59 DEFAULT_PORTS, stringify(resources->ports().getOrElse(Value::Ranges())));
60}
61
62
63// This test verifies that auto-detection of resources is suppressed by

Callers

nothing calls this directly

Calls 8

BytesClass · 0.85
MegabytesFunction · 0.85
getOrElseMethod · 0.80
stringifyFunction · 0.50
cpusMethod · 0.45
memMethod · 0.45
diskMethod · 0.45
portsMethod · 0.45

Tested by

no test coverage detected