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

Function TEST_P

src/tests/executor_http_api_tests.cpp:214–248  ·  view source on GitHub ↗

This test sends a malformed body that cannot be deserialized into a valid protobuf resulting in a BadRequest.

Source from the content-addressed store, hash-verified

212// This test sends a malformed body that cannot be deserialized
213// into a valid protobuf resulting in a BadRequest.
214TEST_P(ExecutorHttpApiTest, MalformedContent)
215{
216 Try<Owned<cluster::Master>> master = StartMaster();
217 ASSERT_SOME(master);
218
219 Future<Nothing> __recover = FUTURE_DISPATCH(_, &Slave::__recover);
220
221 Owned<MasterDetector> detector = master.get()->createDetector();
222
223 slave::Flags flags = CreateSlaveFlags();
224
225 Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), flags);
226 ASSERT_SOME(slave);
227
228 AWAIT_READY(__recover);
229
230 // Wait for recovery to be complete.
231 Clock::pause();
232 Clock::settle();
233
234 const string body = "MALFORMED_CONTENT";
235
236 const ContentType contentType = GetParam();
237 process::http::Headers headers;
238 headers["Accept"] = stringify(contentType);
239
240 Future<Response> response = process::http::post(
241 slave.get()->pid,
242 "api/v1/executor",
243 headers,
244 body,
245 stringify(contentType));
246
247 AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
248}
249
250
251// This test sets an unsupported media type as Content-Type. This

Callers

nothing calls this directly

Calls 15

BadRequestClass · 0.85
OKClass · 0.85
NotAcceptableClass · 0.85
SecondsClass · 0.85
shutdownFunction · 0.85
createDetectorMethod · 0.80
CopyFromMethod · 0.80
typeMethod · 0.80
subscribedMethod · 0.80
postFunction · 0.70
createTaskFunction · 0.70

Tested by

no test coverage detected