use of org.apache.tez.common.security.HistoryACLPolicyManager in project tez by apache.
the class TestATSV15HistoryLoggingService method testNonSessionDomains.
@Test
public void testNonSessionDomains() throws Exception {
ATSV15HistoryLoggingService service = createService(-1);
HistoryACLPolicyManager historyACLPolicyManager = mock(HistoryACLPolicyManager.class);
service.historyACLPolicyManager = historyACLPolicyManager;
when(historyACLPolicyManager.setupSessionACLs((Configuration) any(), eq(appId))).thenReturn(Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_SESSION_DOMAIN_ID, "session-id"));
service.start();
verify(historyACLPolicyManager, times(1)).setupSessionACLs((Configuration) any(), eq(appId));
// Send the event and wait for completion.
TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
for (DAGHistoryEvent event : makeHistoryEvents(dagId1, service)) {
service.handle(event);
}
while (!service.eventQueue.isEmpty()) {
Thread.sleep(100);
}
// No dag domain were created.
verify(historyACLPolicyManager, times(0)).setupSessionDAGACLs((Configuration) any(), eq(appId), eq("0"), (DAGAccessControls) any());
// All calls made with session domain id.
// NOTE: Expect 6 invocations for 5 history events because DAG_SUBMITTED becomes two separate timeline events.
verify(historyACLPolicyManager, times(6)).updateTimelineEntityDomain(any(), eq("session-id"));
assertTrue(entityLog.size() > 0);
service.stop();
}
use of org.apache.tez.common.security.HistoryACLPolicyManager in project tez by apache.
the class TestATSV15HistoryLoggingService method testNonSessionDomainsAclNull.
@Test
public void testNonSessionDomainsAclNull() throws Exception {
ATSV15HistoryLoggingService service = createService(-1);
HistoryACLPolicyManager historyACLPolicyManager = mock(HistoryACLPolicyManager.class);
service.historyACLPolicyManager = historyACLPolicyManager;
when(historyACLPolicyManager.setupSessionACLs((Configuration) any(), eq(appId))).thenReturn(null);
service.start();
verify(historyACLPolicyManager, times(1)).setupSessionACLs((Configuration) any(), eq(appId));
// Send the event and wait for completion.
TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
for (DAGHistoryEvent event : makeHistoryEvents(dagId1, service)) {
service.handle(event);
}
while (!service.eventQueue.isEmpty()) {
Thread.sleep(100);
}
// No dag domain were created.
verify(historyACLPolicyManager, times(0)).setupSessionDAGACLs((Configuration) any(), eq(appId), eq("0"), (DAGAccessControls) any());
// No domain updates but history logging happened.
verify(historyACLPolicyManager, times(0)).updateTimelineEntityDomain(any(), (String) any());
assertTrue(entityLog.size() > 0);
service.stop();
}
Aggregations