Return-Path: X-Original-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 47DAFD6C7 for ; Tue, 9 Oct 2012 00:19:13 +0000 (UTC) Received: (qmail 75708 invoked by uid 500); 9 Oct 2012 00:19:12 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 75666 invoked by uid 500); 9 Oct 2012 00:19:12 -0000 Mailing-List: contact hdfs-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-commits@hadoop.apache.org Received: (qmail 75657 invoked by uid 99); 9 Oct 2012 00:19:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2012 00:19:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2012 00:19:11 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4672A23888FE; Tue, 9 Oct 2012 00:18:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1395821 - in /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java Date: Tue, 09 Oct 2012 00:18:28 -0000 To: hdfs-commits@hadoop.apache.org From: eli@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121009001828.4672A23888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: eli Date: Tue Oct 9 00:18:27 2012 New Revision: 1395821 URL: http://svn.apache.org/viewvc?rev=1395821&view=rev Log: HDFS-4018. TestDataNodeMultipleRegistrations#testMiniDFSClusterWithMultipleNN is missing some cluster cleanup. Contributed by Eli Collins Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1395821&r1=1395820&r2=1395821&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Tue Oct 9 00:18:27 2012 @@ -311,6 +311,9 @@ Release 2.0.3-alpha - Unreleased HDFS-4003. test-patch should build the common native libs before running hdfs tests. (Colin Patrick McCabe via eli) + HDFS-4018. testMiniDFSClusterWithMultipleNN is missing some + cluster cleanup. (eli) + Release 2.0.2-alpha - 2012-09-07 INCOMPATIBLE CHANGES Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java?rev=1395821&r1=1395820&r2=1395821&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java Tue Oct 9 00:18:27 2012 @@ -36,6 +36,7 @@ import org.apache.hadoop.hdfs.MiniDFSNNT import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption; import org.apache.hadoop.hdfs.server.namenode.FSImageTestUtil; import org.apache.hadoop.hdfs.server.namenode.NameNode; +import org.apache.hadoop.util.StringUtils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -216,48 +217,62 @@ public class TestDataNodeMultipleRegistr LOG.info("dn bpos len (still should be 3):" + bposs.length); Assert.assertEquals("should've registered with three namenodes", 3, bposs.length); } finally { - if(cluster != null) - cluster.shutdown(); + cluster.shutdown(); } } @Test public void testMiniDFSClusterWithMultipleNN() throws IOException { - Configuration conf = new HdfsConfiguration(); // start Federated cluster and add a node. MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf) .nnTopology(MiniDFSNNTopology.simpleFederatedTopology(2)) .build(); - Assert.assertNotNull(cluster); - Assert.assertEquals("(1)Should be 2 namenodes", 2, cluster.getNumNameNodes()); // add a node - cluster.addNameNode(conf, 0); - Assert.assertEquals("(1)Should be 3 namenodes", 3, cluster.getNumNameNodes()); - cluster.shutdown(); + try { + Assert.assertNotNull(cluster); + cluster.waitActive(); + Assert.assertEquals("(1)Should be 2 namenodes", 2, cluster.getNumNameNodes()); + + cluster.addNameNode(conf, 0); + Assert.assertEquals("(1)Should be 3 namenodes", 3, cluster.getNumNameNodes()); + } catch (IOException ioe) { + Assert.fail("Failed to add NN to cluster:" + StringUtils.stringifyException(ioe)); + } finally { + cluster.shutdown(); + } // 2. start with Federation flag set conf = new HdfsConfiguration(); cluster = new MiniDFSCluster.Builder(conf) .nnTopology(MiniDFSNNTopology.simpleFederatedTopology(1)) .build(); - Assert.assertNotNull(cluster); - Assert.assertEquals("(2)Should be 1 namenodes", 1, cluster.getNumNameNodes()); - // add a node - cluster.addNameNode(conf, 0); - Assert.assertEquals("(2)Should be 2 namenodes", 2, cluster.getNumNameNodes()); - cluster.shutdown(); + try { + Assert.assertNotNull(cluster); + cluster.waitActive(); + Assert.assertEquals("(2)Should be 1 namenodes", 1, cluster.getNumNameNodes()); + + // add a node + cluster.addNameNode(conf, 0); + Assert.assertEquals("(2)Should be 2 namenodes", 2, cluster.getNumNameNodes()); + } catch (IOException ioe) { + Assert.fail("Failed to add NN to cluster:" + StringUtils.stringifyException(ioe)); + } finally { + cluster.shutdown(); + } // 3. start non-federated conf = new HdfsConfiguration(); cluster = new MiniDFSCluster.Builder(conf).build(); - Assert.assertNotNull(cluster); - Assert.assertEquals("(2)Should be 1 namenodes", 1, cluster.getNumNameNodes()); // add a node try { + cluster.waitActive(); + Assert.assertNotNull(cluster); + Assert.assertEquals("(2)Should be 1 namenodes", 1, cluster.getNumNameNodes()); + cluster.addNameNode(conf, 9929); Assert.fail("shouldn't be able to add another NN to non federated cluster"); } catch (IOException e) { @@ -268,6 +283,4 @@ public class TestDataNodeMultipleRegistr cluster.shutdown(); } } - - }