Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A3B8F200C64 for ; Fri, 14 Apr 2017 00:44:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A2749160BAA; Thu, 13 Apr 2017 22:44:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EE881160B98 for ; Fri, 14 Apr 2017 00:44:41 +0200 (CEST) Received: (qmail 80130 invoked by uid 500); 13 Apr 2017 22:44:41 -0000 Mailing-List: contact commits-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mesos.apache.org Delivered-To: mailing list commits@mesos.apache.org Received: (qmail 80121 invoked by uid 99); 13 Apr 2017 22:44:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Apr 2017 22:44:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 06795E0061; Thu, 13 Apr 2017 22:44:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vinodkone@apache.org To: commits@mesos.apache.org Date: Thu, 13 Apr 2017 22:44:41 -0000 Message-Id: In-Reply-To: <28e849b24d834bf8b21778df4cf1c138@git.apache.org> References: <28e849b24d834bf8b21778df4cf1c138@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] mesos git commit: Updated tests to set '--executor_secret_key' as a path. archived-at: Thu, 13 Apr 2017 22:44:42 -0000 Updated tests to set '--executor_secret_key' as a path. This patch updates the test code to generate a secret key file and set the agent '--executor_secret_key' flag with its path. Review: https://reviews.apache.org/r/58328/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8bbe7004 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8bbe7004 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8bbe7004 Branch: refs/heads/master Commit: 8bbe700411298b7b17219f9521820b9dcc7ef2c8 Parents: 0b7a401 Author: Greg Mann Authored: Thu Apr 13 15:44:28 2017 -0700 Committer: Vinod Kone Committed: Thu Apr 13 15:44:28 2017 -0700 ---------------------------------------------------------------------- src/tests/mesos.cpp | 20 +++++++++++++++++++- src/tests/mesos.hpp | 5 +++++ 2 files changed, 24 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/8bbe7004/src/tests/mesos.cpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp index 099ec37..27cfcab 100644 --- a/src/tests/mesos.cpp +++ b/src/tests/mesos.cpp @@ -212,7 +212,25 @@ slave::Flags MesosTest::CreateSlaveFlags() // Executor authentication currently has SSL as a dependency, so we // cannot enable it if Mesos was not built with SSL support. flags.authenticate_http_executors = true; - flags.executor_secret_key = "secret_key"; + + { + // Create a secret key for executor authentication. + const string path = path::join(directory.get(), "executor_secret_key"); + + Try fd = os::open( + path, + O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, + S_IRUSR | S_IWUSR | S_IRGRP); + + CHECK_SOME(fd); + + CHECK_SOME(os::write(fd.get(), DEFAULT_EXECUTOR_SECRET_KEY)) + << "Failed to write executor secret key to '" << path << "'"; + + CHECK_SOME(os::close(fd.get())); + + flags.executor_secret_key = path; + } #endif // USE_SSL_SOCKET { http://git-wip-us.apache.org/repos/asf/mesos/blob/8bbe7004/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index fe897c1..3cff0e7 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -99,6 +99,11 @@ namespace tests { constexpr char READONLY_HTTP_AUTHENTICATION_REALM[] = "test-readonly-realm"; constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[] = "test-readwrite-realm"; constexpr char DEFAULT_TEST_ROLE[] = "default-role"; +constexpr char DEFAULT_EXECUTOR_SECRET_KEY[] = + "72kUKUFtghAjNbIOvLzfF2RxNBfeM64Bri8g9WhpyaunwqRB/yozHAqSnyHbddAV" + "PcWRQlrJAt871oWgSH+n52vMZ3aVI+AFMzXSo8+sUfMk83IGp0WJefhzeQsjDlGH" + "GYQgCAuGim0BE2X5U+lEue8s697uQpAO8L/FFRuDH2s"; + // Forward declarations. class MockExecutor;