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

Function TEST_F

src/tests/logging_tests.cpp:95–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94
95TEST_F(LoggingTest, Toggle)
96{
97 process::PID<> pid;
98 pid.id = "logging";
99 pid.address = process::address();
100
101 process::Future<Response> response = process::http::get(pid, "toggle");
102
103 AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
104
105 response = process::http::get(pid, "toggle", "level=0");
106
107 AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
108 AWAIT_EXPECT_RESPONSE_BODY_EQ(
109 "Expecting 'duration=value' in query.\n",
110 response);
111
112 response = process::http::get(pid, "toggle", "duration=10secs");
113
114 AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
115 AWAIT_EXPECT_RESPONSE_BODY_EQ(
116 "Expecting 'level=value' in query.\n",
117 response);
118
119 response = process::http::get(pid, "toggle", "duration=10secs");
120
121 AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
122 AWAIT_EXPECT_RESPONSE_BODY_EQ(
123 "Expecting 'level=value' in query.\n",
124 response);
125
126 response = process::http::get(pid, "toggle", "level=-1&duration=10secs");
127
128 AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
129 AWAIT_EXPECT_RESPONSE_BODY_EQ(
130 "Invalid level '-1'.\n",
131 response);
132
133 response = process::http::get(pid, "toggle", "level=-1&duration=10secs");
134
135 AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
136 AWAIT_EXPECT_RESPONSE_BODY_EQ(
137 "Invalid level '-1'.\n",
138 response);
139}
140
141
142// Tests that the `/logging/toggle` endpoint rejects unauthenticated requests

Callers

nothing calls this directly

Calls 14

OKClass · 0.85
BadRequestClass · 0.85
UnauthorizedClass · 0.85
setCallbacksFunction · 0.85
NoneClass · 0.85
createBasicAuthHeadersFunction · 0.85
ForbiddenClass · 0.85
CopyFromMethod · 0.80
principalMethod · 0.80
addressFunction · 0.50
getFunction · 0.50

Tested by

no test coverage detected