Browse Source

HDFS-7001. Tests in TestTracing should not depend on the order of execution. (iwasakims via cmccabe)
(cherry picked from commit 7b8df93ce1b7204a247e64b394d57eef748e73aa)

Colin Patrick Mccabe 10 năm trước cách đây
mục cha
commit
cac7063b31

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -450,6 +450,9 @@ Release 2.6.0 - UNRELEASED
     HDFS-7106. Reconfiguring DataNode volumes does not release the lock files
     in removed volumes. (cnauroth via cmccabe)
 
+    HDFS-7001. Tests in TestTracing depends on the order of execution
+    (iwasakims via cmccabe)
+
     BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS
   
       HDFS-6387. HDFS CLI admin tool for creating & deleting an

+ 9 - 5
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java

@@ -53,13 +53,15 @@ public class TestTracing {
   private static Configuration conf;
   private static MiniDFSCluster cluster;
   private static DistributedFileSystem dfs;
+  private static SpanReceiverHost spanReceiverHost;
 
   @Test
-  public void testSpanReceiverHost() throws Exception {
-    Configuration conf = new Configuration();
-    conf.set(SpanReceiverHost.SPAN_RECEIVERS_CONF_KEY,
-        SetSpanReceiver.class.getName());
-    SpanReceiverHost spanReceiverHost = SpanReceiverHost.getInstance(conf);
+  public void testGetSpanReceiverHost() throws Exception {
+    Configuration c = new Configuration();
+    // getting instance already loaded.
+    c.set(SpanReceiverHost.SPAN_RECEIVERS_CONF_KEY, "");
+    SpanReceiverHost s = SpanReceiverHost.getInstance(c);
+    Assert.assertEquals(spanReceiverHost, s);
   }
 
   @Test
@@ -228,8 +230,10 @@ public class TestTracing {
     cluster = new MiniDFSCluster.Builder(conf)
         .numDataNodes(3)
         .build();
+    cluster.waitActive();
 
     dfs = cluster.getFileSystem();
+    spanReceiverHost = SpanReceiverHost.getInstance(conf);
   }
 
   @AfterClass