Return-Path: X-Original-To: apmail-bigtop-commits-archive@www.apache.org Delivered-To: apmail-bigtop-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 164DA18B69 for ; Fri, 22 Jan 2016 21:20:29 +0000 (UTC) Received: (qmail 43571 invoked by uid 500); 22 Jan 2016 21:20:29 -0000 Delivered-To: apmail-bigtop-commits-archive@bigtop.apache.org Received: (qmail 43528 invoked by uid 500); 22 Jan 2016 21:20:29 -0000 Mailing-List: contact commits-help@bigtop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bigtop-dev@bigtop.apache.org Delivered-To: mailing list commits@bigtop.apache.org Received: (qmail 43519 invoked by uid 99); 22 Jan 2016 21:20:29 -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; Fri, 22 Jan 2016 21:20:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CE5C5E0098; Fri, 22 Jan 2016 21:20:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cos@apache.org To: commits@bigtop.apache.org Message-Id: <205a09ac06c143789de02419359af1c6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: bigtop git commit: BIGTOP-1940. Consider removing tests expecting 'sudo' from skip-list Date: Fri, 22 Jan 2016 21:20:28 +0000 (UTC) Repository: bigtop Updated Branches: refs/heads/master 5b13e6030 -> 07d903605 BIGTOP-1940. Consider removing tests expecting 'sudo' from skip-list Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/07d90360 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/07d90360 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/07d90360 Branch: refs/heads/master Commit: 07d9036052514a3172c96ebc2062e90cf9c47682 Parents: 5b13e60 Author: Konstantin Boudnik Authored: Fri Jul 24 16:36:14 2015 -0700 Committer: Konstantin Boudnik Committed: Fri Jan 22 13:20:11 2016 -0800 ---------------------------------------------------------------------- .../main/groovy/org/apache/bigtop/itest/TestUtils.groovy | 11 +++++++++++ .../itest/failures/IntegrationTestClusterFailures.groovy | 3 +++ .../bigtop/itest/pmanager/PackageManagerTest.groovy | 9 +++++---- .../org/apache/bigtop/itest/shell/ShellTest.groovy | 5 +++-- 4 files changed, 22 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/07d90360/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy ---------------------------------------------------------------------- diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy index b513681..2012cd7 100644 --- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy +++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy @@ -18,6 +18,8 @@ package org.apache.bigtop.itest +import org.junit.Assume + import static org.junit.Assert.assertTrue import org.apache.bigtop.itest.shell.Shell @@ -77,4 +79,13 @@ public class TestUtils { assertTrue("Could not create output directory in DFS", sh.getRet() == 0); } } + + /** + * Method makes a quick check to validate if password-less sudo is configured + * @return false if password-less sudo is disabled; + * true otherwise + */ + public static boolean noPassSudo () { + return new Shell().exec("sudo -n true").ret == 0 + } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/07d90360/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/failures/IntegrationTestClusterFailures.groovy ---------------------------------------------------------------------- diff --git a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/failures/IntegrationTestClusterFailures.groovy b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/failures/IntegrationTestClusterFailures.groovy index 60be92a..036fd17 100644 --- a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/failures/IntegrationTestClusterFailures.groovy +++ b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/failures/IntegrationTestClusterFailures.groovy @@ -18,7 +18,9 @@ package org.apache.bigtop.itest.failures +import org.apache.bigtop.itest.TestUtils import org.apache.bigtop.itest.shell.OS +import org.junit.Assume import org.junit.Before import org.junit.Test import org.apache.bigtop.itest.shell.Shell @@ -45,6 +47,7 @@ public class IntegrationTestClusterFailures { @Before void configureVars() { + Assume.assumeTrue("Password-less sudo should be enabled", TestUtils.noPassSudo()) def f = FailureVars.getInstance(); testHost = f.getTestHost(); testRemoteHost = f.getTestRemoteHost(); http://git-wip-us.apache.org/repos/asf/bigtop/blob/07d90360/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/pmanager/PackageManagerTest.groovy ---------------------------------------------------------------------- diff --git a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/pmanager/PackageManagerTest.groovy b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/pmanager/PackageManagerTest.groovy index 5d67fed..f9ad68b 100644 --- a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/pmanager/PackageManagerTest.groovy +++ b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/pmanager/PackageManagerTest.groovy @@ -18,9 +18,10 @@ package org.apache.bigtop.itest.pmanager +import org.apache.bigtop.itest.TestUtils import org.apache.bigtop.itest.shell.OS +import org.junit.Assume import org.junit.Test -import org.junit.Ignore import static org.junit.Assert.assertTrue import static org.junit.Assert.assertEquals import static org.junit.Assert.assertFalse @@ -58,9 +59,9 @@ class PackageManagerTest { assertFalse("can not get size for the gcc package", pkgs.get(0).getMeta()["size"]?.size() == 0); } - @Ignore("required sudo") @Test void installBash() { + Assume.assumeTrue("Password-less sudo should be enabled", TestUtils.noPassSudo()) PackageInstance bash_pkg = PackageInstance.getPackageInstance(pmgr, "bash"); assertTrue("can not install pacakge bash", (bash_pkg.install() == 0)); @@ -118,9 +119,9 @@ class PackageManagerTest { assertTrue("cron package is expected to contain at least a few config files", list.size() > 0); } - @Ignore("required sudo") @Test void testRepoManagement() { + Assume.assumeTrue("Password-less sudo should be enabled", TestUtils.noPassSudo()) String repo_id = "test-repo"; assertEquals("Can not add repo", 0, pmgr.addBinRepo(repo_id, "http://127.0.0.1", null, "random strings here")); @@ -128,9 +129,9 @@ class PackageManagerTest { 0, pmgr.removeBinRepo(repo_id)); } - @Ignore("required sudo") @Test void testRepoFileManagement() { + Assume.assumeTrue("Password-less sudo should be enabled", TestUtils.noPassSudo()) String repo_id = "test-repo"; assertEquals("Can not add repo", 0, pmgr.addBinRepo(repo_id, "random strings here")); http://git-wip-us.apache.org/repos/asf/bigtop/blob/07d90360/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/shell/ShellTest.groovy ---------------------------------------------------------------------- diff --git a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/shell/ShellTest.groovy b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/shell/ShellTest.groovy index 1571e10..73a4de1 100644 --- a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/shell/ShellTest.groovy +++ b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/shell/ShellTest.groovy @@ -18,7 +18,8 @@ package org.apache.bigtop.itest.shell -import org.junit.Ignore +import org.apache.bigtop.itest.TestUtils +import org.junit.Assume import org.junit.Test import static org.junit.Assert.assertEquals @@ -36,9 +37,9 @@ class ShellTest { assertEquals("got extra stderr ${sh.err}", 0, sh.err.size()) } - @Ignore("requires sudo") @Test void superUserShell() { + Assume.assumeTrue("Password-less sudo should be enabled", TestUtils.noPassSudo()) Shell sh = new Shell("/bin/bash -s") sh.setUser('root')