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

Function TEST_F

src/tests/container_daemon_tests.cpp:75–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74
75TEST_F(ContainerDaemonTest, RestartOnTermination)
76{
77 Try<Owned<cluster::Master>> master = StartMaster();
78 ASSERT_SOME(master);
79
80 Owned<MasterDetector> detector = master.get()->createDetector();
81 Owned<SecretGenerator> secretGenerator;
82
83 slave::Flags slaveFlags = CreateSlaveFlags();
84
85#ifdef USE_SSL_SOCKET
86 ASSERT_SOME(slaveFlags.jwt_secret_key);
87
88 Try<string> jwtSecretKey = os::read(slaveFlags.jwt_secret_key.get());
89 ASSERT_SOME(jwtSecretKey);
90
91 secretGenerator.reset(new JWTSecretGenerator(jwtSecretKey.get()));
92#endif // USE_SSL_SOCKET
93
94 Future<Nothing> recover = FUTURE_DISPATCH(_, &Slave::__recover);
95
96 Try<Owned<cluster::Slave>> slave = StartSlave(
97 detector.get(),
98 secretGenerator.get(),
99 slaveFlags);
100
101 ASSERT_SOME(slave);
102
103 PID<Slave> slavePid = slave.get()->pid;
104
105 // Ensure slave has finished recovery.
106 AWAIT_READY(recover);
107
108 string scheme = "http";
109
110#ifdef USE_SSL_SOCKET
111 if (openssl::flags().enabled) {
112 scheme = "https";
113 }
114#endif // USE_SSL_SOCKET
115
116 http::URL url(
117 scheme,
118 slavePid.address.ip,
119 slavePid.address.port,
120 strings::join("/", slavePid.id, "api/v1"));
121
122 // NOTE: The current implicit authorization for creating standalone
123 // containers is to check if the container ID prefix in the claims
124 // of the principal is indeed a prefix of the container ID that is
125 // specified in the API call.
126 string containerIdPrefix = id::UUID::random().toString();
127
128 ContainerID containerId;
129 containerId.set_value(strings::join(
130 "-",
131 containerIdPrefix,
132 id::UUID::random().toString()));

Callers

nothing calls this directly

Calls 15

randomFunction · 0.85
NoneClass · 0.85
validateSecretFunction · 0.85
NothingClass · 0.85
createCommandInfoFunction · 0.85
createDetectorMethod · 0.80
typeMethod · 0.80
dataMethod · 0.80
readFunction · 0.50
joinFunction · 0.50
createFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected