2828import  org .apache .hadoop .conf .Configuration ;
2929import  org .apache .hadoop .hbase .ConnectionRule ;
3030import  org .apache .hadoop .hbase .HBaseClassTestRule ;
31+ import  org .apache .hadoop .hbase .HBaseConfiguration ;
3132import  org .apache .hadoop .hbase .HConstants ;
3233import  org .apache .hadoop .hbase .MiniClusterRule ;
3334import  org .apache .hadoop .hbase .ServerName ;
@@ -72,8 +73,9 @@ public class TestApiV1ClusterMetricsResource {
7273      .build ())
7374    .setConfiguration (() -> {
7475      // enable Master InfoServer and random port selection 
75-       final  Configuration  conf  = new   Configuration ();
76+       final  Configuration  conf  = HBaseConfiguration . create ();
7677      conf .setInt (HConstants .MASTER_INFO_PORT , 0 );
78+       conf .set ("hbase.http.jersey.tracing.type" , "ON_DEMAND" );
7779      return  conf ;
7880    })
7981    .build ();
@@ -148,6 +150,7 @@ protected void after() {
148150  public  void  testGetRoot () {
149151    final  String  response  = classRule .getTarget ()
150152      .request (MediaType .APPLICATION_JSON_TYPE )
153+       .header ("X-Jersey-Tracing-Accept" , true )
151154      .get (String .class );
152155    assertThat (response , allOf (
153156      containsString ("\" hbase_version\" :" ),
@@ -160,6 +163,7 @@ public void testGetRoot() {
160163  public  void  testGetRootHtml () {
161164    assertThrows (NotAcceptableException .class , () -> classRule .getTarget ()
162165      .request (MediaType .TEXT_HTML_TYPE )
166+       .header ("X-Jersey-Tracing-Accept" , true )
163167      .get (String .class ));
164168  }
165169
@@ -168,6 +172,7 @@ public void testGetLiveServers() {
168172    final  String  response  = classRule .getTarget ()
169173      .path ("live_servers" )
170174      .request (MediaType .APPLICATION_JSON_TYPE )
175+       .header ("X-Jersey-Tracing-Accept" , true )
171176      .get (String .class );
172177    assertThat (response , allOf (
173178      startsWith ("{\" data\" :[" ),
@@ -179,6 +184,7 @@ public void testGetLiveServersHtml() {
179184    assertThrows (NotAcceptableException .class , () -> classRule .getTarget ()
180185      .path ("live_servers" )
181186      .request (MediaType .TEXT_HTML_TYPE )
187+       .header ("X-Jersey-Tracing-Accept" , true )
182188      .get (String .class ));
183189  }
184190
@@ -187,6 +193,7 @@ public void testGetDeadServers() {
187193    final  String  response  = classRule .getTarget ()
188194      .path ("dead_servers" )
189195      .request (MediaType .APPLICATION_JSON_TYPE )
196+       .header ("X-Jersey-Tracing-Accept" , true )
190197      .get (String .class );
191198    assertThat (response , allOf (
192199      startsWith ("{\" data\" :[" ),
@@ -198,6 +205,7 @@ public void testGetDeadServersHtml() {
198205    assertThrows (NotAcceptableException .class , () -> classRule .getTarget ()
199206      .path ("dead_servers" )
200207      .request (MediaType .TEXT_HTML_TYPE )
208+       .header ("X-Jersey-Tracing-Accept" , true )
201209      .get (String .class ));
202210  }
203211}
0 commit comments