BIGTOP-1141. Add TestYarnNode to test yarn node
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/6350308f Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/6350308f Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/6350308f Branch: refs/heads/master Commit: 6350308f6e422ff7277850ec6dde6bfd05210993 Parents: dfa9973 Author: wenwu <[email protected]> Authored: Thu Nov 7 17:51:08 2013 +0800 Committer: Roman Shaposhnik <[email protected]> Committed: Thu Nov 7 09:17:59 2013 -0800 ---------------------------------------------------------------------- .../bigtop/itest/hadoop/yarn/TestNode.groovy | 58 ++++++++++++++++++++ 1 file changed, 58 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/6350308f/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/yarn/TestNode.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/yarn/TestNode.groovy b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/yarn/TestNode.groovy new file mode 100644 index 0000000..48bb1ec --- /dev/null +++ b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/yarn/TestNode.groovy @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.bigtop.itest.hadoop.yarn; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.apache.bigtop.itest.JarContent; +import org.apache.bigtop.itest.shell.Shell; + +public class TestNode { + + // set debugging variable to true if you want error messages sent to stdout + private static Shell sh = new Shell("/bin/bash"); + + @BeforeClass + public static void setUp() { + // unpack resource + JarContent.unpackJarContainer(TestNode.class, "." , null); + System.out.println("Running Node commands:"); + } + + @AfterClass + public static void tearDown() { + } + + @Test + public void testNodeBasic() { + // list + System.out.println("-list"); + sh.exec("YARN_ROOT_LOGGER=WARN,console yarn node -list"); + assertTrue("-list failed", sh.getRet() == 0); + + // status + System.out.println("-status"); + String NodeId = sh.getOut().get(2).trim().split()[0]; + sh.exec("yarn node -status " + NodeId); + assertTrue("-status failed", sh.getRet() == 0); + } +}
