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

Function TEST_F

src/tests/executor_http_api_tests.cpp:135–170  ·  view source on GitHub ↗

This test expects a BadRequest when 'Content-Type' is omitted.

Source from the content-addressed store, hash-verified

133
134// This test expects a BadRequest when 'Content-Type' is omitted.
135TEST_F(ExecutorHttpApiTest, NoContentType)
136{
137 Try<Owned<cluster::Master>> master = StartMaster();
138 ASSERT_SOME(master);
139
140 Future<Nothing> __recover = FUTURE_DISPATCH(_, &Slave::__recover);
141
142 Owned<MasterDetector> detector = master.get()->createDetector();
143
144 slave::Flags flags = CreateSlaveFlags();
145
146 Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), flags);
147 ASSERT_SOME(slave);
148
149 AWAIT_READY(__recover);
150
151 // Wait for recovery to be complete.
152 Clock::pause();
153 Clock::settle();
154
155 Call call;
156 call.mutable_framework_id()->set_value("dummy_framework_id");
157 call.mutable_executor_id()->set_value("dummy_executor_id");
158 call.set_type(Call::MESSAGE);
159
160 call.mutable_message()->set_data("hello world");
161
162 Future<Response> response = process::http::post(
163 slave.get()->pid,
164 "api/v1/executor",
165 None(),
166 serialize(ContentType::JSON, call),
167 None());
168
169 AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
170}
171
172
173// This test sends a valid JSON blob that cannot be deserialized

Callers

nothing calls this directly

Calls 15

NoneClass · 0.85
BadRequestClass · 0.85
MethodNotAllowedClass · 0.85
ServiceUnavailableClass · 0.85
OKClass · 0.85
NothingClass · 0.85
AcceptedClass · 0.85
createDetectorMethod · 0.80
CopyFromMethod · 0.80
writerMethod · 0.80
readerMethod · 0.80
typeMethod · 0.80

Tested by

no test coverage detected