Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<leveldbjni-all.version>1.8</leveldbjni-all.version>
<lifecycle-mapping.version>1.0.0</lifecycle-mapping.version>
<metrics-core.version>3.1.0</metrics-core.version>
<mockito-core.version>4.8.1</mockito-core.version>
<mockito-core.version>5.23.0</mockito-core.version>
<netty.version>4.1.130.Final</netty.version>
<pig.version>0.13.0</pig.version>
<protobuf.version>3.25.5</protobuf.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public void testGetClient() throws Exception {
client2.stop();
verify(client2.sessionAmProxy, times(1)).shutdownSession(any(),
any());
verify(client2.mockYarnClient, times(1)).stop();
verify(client2.mockYarnClient, times(1)).close();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mockito4 couldn't mock final methods and yarnClient.close() was final so it was checking for stop() in AbstractService.java

 @Override
  public final void close() throws IOException {
    stop();
  }

But in Mockito 5 it can mock final method so it will test for close()

/* END reuse of AM from new TezClient */
}

Expand Down Expand Up @@ -501,7 +501,7 @@ public TezClientForTest testTezClient(boolean isSession, boolean shouldStop, Str
verify(client.sessionAmProxy, times(1)).shutdownSession(any(),
any());
}
verify(client.mockYarnClient, times(1)).stop();
verify(client.mockYarnClient, times(1)).close();
}
return client;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.timeline.TimelineEntity;
import org.apache.hadoop.yarn.client.api.TimelineClient;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.util.SystemClock;
Expand Down Expand Up @@ -103,7 +104,7 @@ public void setup() throws Exception {
when(appContext.getCurrentDAGID()).thenReturn(null);
when(appContext.getApplicationID()).thenReturn(appId);
when(atsHistoryLoggingService.timelineClient.putEntities(
any())).thenAnswer(
any(TimelineEntity[].class))).thenAnswer(
new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Expand Down Expand Up @@ -188,7 +189,7 @@ public void testTimelineServiceDisable() throws Exception {

atsHistoryLoggingService1.setAppContext(appContext);
atsHistoryLoggingService1.timelineClient = mock(TimelineClient.class);
when(atsHistoryLoggingService1.timelineClient.putEntities(any())).thenAnswer(
when(atsHistoryLoggingService1.timelineClient.putEntities(any(TimelineEntity[].class))).thenAnswer(
new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testDagNumber() throws IOException {
vertexParallelism,
taskAttemptId,
null,
runtimeTask,
mockTask,
serviceConsumerMetadata,
auxServiceEnv,
memDist,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentMatchers;
import org.slf4j.Logger;

public class TestShuffleUtils {
Expand Down Expand Up @@ -398,14 +397,14 @@ public void testFetchStatsLogger() throws Exception {
logger.logIndividualFetchComplete(10, 100, 1000, "testType", ident);
}
verify(activeLogger, times(0)).info(anyString());
verify(aggregateLogger, times(1)).info(anyString(), ArgumentMatchers.<Object[]>any());
verify(aggregateLogger, times(1)).info(anyString(), any(), any(), any(), any(), any());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image


when(activeLogger.isInfoEnabled()).thenReturn(true);
for (int i = 0; i < 1000; i++) {
logger.logIndividualFetchComplete(10, 100, 1000, "testType", ident);
}
verify(activeLogger, times(1000)).info(anyString());
verify(aggregateLogger, times(1)).info(anyString(), ArgumentMatchers.<Object[]>any());
verify(aggregateLogger, times(1)).info(anyString(), any(), any(), any(), any(), any());
}

/**
Expand Down