YARN-8856. TestTimelineReaderWebServicesHBaseStorage tests failing with NoClassDefFoundError. Contributed by Sushil Ks.
This commit is contained in:
parent
d40912b1bd
commit
eeaf8edaa7
|
@ -317,6 +317,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jmockit</groupId>
|
||||
<artifactId>jmockit</artifactId>
|
||||
<version>1.24</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hbase</groupId>
|
||||
<artifactId>hbase-testing-util</artifactId>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* 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.hadoop.yarn.server.timelineservice.reader;
|
||||
|
||||
import org.apache.hadoop.yarn.server.timelineservice.metrics.TimelineReaderMetrics;
|
||||
|
||||
/**
|
||||
* DummyTimelineReaderMetrics for mocking {@link TimelineReaderMetrics} calls.
|
||||
*/
|
||||
public class DummyTimelineReaderMetrics extends TimelineReaderMetrics {
|
||||
|
||||
|
||||
@Override
|
||||
public void addGetEntitiesLatency(
|
||||
long durationMs, boolean succeeded) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGetEntityTypesLatency(
|
||||
long durationMs, boolean succeeded) {
|
||||
}
|
||||
}
|
|
@ -35,6 +35,8 @@ import java.util.Set;
|
|||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import mockit.Mock;
|
||||
import mockit.MockUp;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
|
@ -50,6 +52,7 @@ import org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric;
|
|||
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric.Type;
|
||||
import org.apache.hadoop.yarn.server.metrics.ApplicationMetricsConstants;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.collector.TimelineCollectorContext;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.metrics.TimelineReaderMetrics;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.HBaseTimelineWriterImpl;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineSchemaUtils;
|
||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||
|
@ -73,9 +76,17 @@ public class TestTimelineReaderWebServicesHBaseStorage
|
|||
private static long dayTs =
|
||||
HBaseTimelineSchemaUtils.getTopOfTheDayTimestamp(ts);
|
||||
private static String doAsUser = "remoteuser";
|
||||
private static final DummyTimelineReaderMetrics METRICS
|
||||
= new DummyTimelineReaderMetrics();
|
||||
|
||||
@BeforeClass
|
||||
public static void setupBeforeClass() throws Exception {
|
||||
new MockUp<TimelineReaderMetrics>() {
|
||||
@Mock
|
||||
public TimelineReaderMetrics getInstance() {
|
||||
return METRICS;
|
||||
}
|
||||
};
|
||||
setup();
|
||||
loadData();
|
||||
initialize();
|
||||
|
|
|
@ -33,7 +33,7 @@ import static org.apache.hadoop.metrics2.lib.Interns.info;
|
|||
* Metrics class for TimelineReader.
|
||||
*/
|
||||
@Metrics(about = "Metrics for timeline reader", context = "timelineservice")
|
||||
final public class TimelineReaderMetrics {
|
||||
public class TimelineReaderMetrics {
|
||||
|
||||
private final static MetricsInfo METRICS_INFO = info("TimelineReaderMetrics",
|
||||
"Metrics for TimelineReader");
|
||||
|
@ -50,7 +50,8 @@ final public class TimelineReaderMetrics {
|
|||
@Metric(about = "GET entity types success latency", valueName = "latency")
|
||||
private MutableQuantiles getEntityTypesSuccessLatency;
|
||||
|
||||
private TimelineReaderMetrics() {
|
||||
@VisibleForTesting
|
||||
protected TimelineReaderMetrics() {
|
||||
}
|
||||
|
||||
public static TimelineReaderMetrics getInstance() {
|
||||
|
|
Loading…
Reference in New Issue