You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by me...@apache.org on 2016/04/10 12:47:51 UTC
[3/3] mesos git commit: Added authentication test for /weights GET
request.
Added authentication test for /weights GET request.
Review: https://reviews.apache.org/r/45203/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0e5680c5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0e5680c5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0e5680c5
Branch: refs/heads/master
Commit: 0e5680c51ce7479f294cc654007a007f2eaeb05d
Parents: a28f9e5
Author: Yongqiao Wang <yq...@cn.ibm.com>
Authored: Sun Apr 10 00:40:50 2016 -0700
Committer: Adam B <ad...@mesosphere.io>
Committed: Sun Apr 10 02:50:22 2016 -0700
----------------------------------------------------------------------
src/tests/dynamic_weights_tests.cpp | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0e5680c5/src/tests/dynamic_weights_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/dynamic_weights_tests.cpp b/src/tests/dynamic_weights_tests.cpp
index 614ff2d..f89b89d 100644
--- a/src/tests/dynamic_weights_tests.cpp
+++ b/src/tests/dynamic_weights_tests.cpp
@@ -540,6 +540,33 @@ TEST_F(DynamicWeightsTest, UnauthenticatedUpdateWeightRequest)
}
+// Checks that a weight query request is rejected for unauthenticated
+// principals.
+TEST_F(DynamicWeightsTest, UnauthenticatedQueryWeightRequest)
+{
+ // The master is configured so that only requests from `DEFAULT_CREDENTIAL`
+ // are authenticated.
+ Try<Owned<cluster::Master>> master = StartMaster();
+ ASSERT_SOME(master);
+
+ Credential credential;
+ credential.set_principal("unknown-principal");
+ credential.set_secret("test-secret");
+
+ // Send a weight query request.
+ Future<Response> response = process::http::request(
+ process::http::createRequest(
+ master.get()->pid,
+ "GET",
+ false,
+ "weights",
+ createBasicAuthHeaders(credential)));
+
+ AWAIT_EXPECT_RESPONSE_STATUS_EQ(Unauthorized({}).status, response)
+ << response.get().body;
+}
+
+
// Checks that an authorized principal can update weight with implicit roles.
TEST_F(DynamicWeightsTest, AuthorizedWeightUpdateRequest)
{