You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by co...@apache.org on 2016/01/22 22:20:28 UTC
bigtop git commit: BIGTOP-1940. Consider removing tests expecting
'sudo' from skip-list
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 <co...@wandisco.com>
Authored: Fri Jul 24 16:36:14 2015 -0700
Committer: Konstantin Boudnik <co...@apache.org>
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 <code>false</code> if password-less sudo is disabled;
+ * <code>true</code> 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')