Program: 5380
Project: 5380
Buggy source:
@Ignore @Test public void testRemoteUGIProvider() throws Exception {
  final NettyHttpService httpService=NettyHttpService.builder("String_Node_Str").addHttpHandlers(Collections.singleton(new UGIProviderTestHandler())).build();
  httpService.startAndWait();
  try {
    InMemoryDiscoveryService discoveryService=new InMemoryDiscoveryService();
    discoveryService.register(new Discoverable(Constants.Service.APP_FABRIC_HTTP,httpService.getBindAddress()));
    RemoteUGIProvider ugiProvider=new RemoteUGIProvider(cConf,discoveryService,locationFactory);
    ImpersonationInfo aliceInfo=new ImpersonationInfo(getPrincipal("String_Node_Str"),keytabFile.toURI().toString());
    UserGroupInformation aliceUGI=ugiProvider.getConfiguredUGI(aliceInfo);
    Assert.assertFalse(aliceUGI.hasKerberosCredentials());
    Token<? extends TokenIdentifier> token=aliceUGI.getCredentials().getToken(new Text("String_Node_Str"));
    Assert.assertArrayEquals(aliceInfo.getPrincipal().getBytes(StandardCharsets.UTF_8),token.getIdentifier());
    Assert.assertArrayEquals(aliceInfo.getPrincipal().getBytes(StandardCharsets.UTF_8),token.getPassword());
    Assert.assertEquals(new Text("String_Node_Str"),token.getKind());
    Assert.assertEquals(new Text("String_Node_Str"),token.getService());
    token=aliceUGI.getCredentials().getToken(new Text("String_Node_Str"));
    Assert.assertArrayEquals(aliceInfo.getKeytabURI().getBytes(StandardCharsets.UTF_8),token.getIdentifier());
    Assert.assertArrayEquals(aliceInfo.getKeytabURI().getBytes(StandardCharsets.UTF_8),token.getPassword());
    Assert.assertEquals(new Text("String_Node_Str"),token.getKind());
    Assert.assertEquals(new Text("String_Node_Str"),token.getService());
    Assert.assertSame(aliceUGI,ugiProvider.getConfiguredUGI(aliceInfo));
    ugiProvider.invalidCache();
    Assert.assertNotSame(aliceUGI,ugiProvider.getConfiguredUGI(aliceInfo));
  }
  finally {
    httpService.stopAndWait();
  }
}

Fixed version (ground truth):
@Test public void testRemoteUGIProvider() throws Exception {
  final NettyHttpService httpService=NettyHttpService.builder("String_Node_Str").addHttpHandlers(Collections.singleton(new UGIProviderTestHandler())).build();
  httpService.startAndWait();
  try {
    InMemoryDiscoveryService discoveryService=new InMemoryDiscoveryService();
    discoveryService.register(new Discoverable(Constants.Service.APP_FABRIC_HTTP,httpService.getBindAddress()));
    RemoteUGIProvider ugiProvider=new RemoteUGIProvider(cConf,discoveryService,locationFactory);
    ImpersonationInfo aliceInfo=new ImpersonationInfo(getPrincipal("String_Node_Str"),keytabFile.toURI().toString());
    UserGroupInformation aliceUGI=ugiProvider.getConfiguredUGI(aliceInfo);
    Assert.assertFalse(aliceUGI.hasKerberosCredentials());
    Token<? extends TokenIdentifier> token=aliceUGI.getCredentials().getToken(new Text("String_Node_Str"));
    Assert.assertArrayEquals(aliceInfo.getPrincipal().getBytes(StandardCharsets.UTF_8),token.getIdentifier());
    Assert.assertArrayEquals(aliceInfo.getPrincipal().getBytes(StandardCharsets.UTF_8),token.getPassword());
    Assert.assertEquals(new Text("String_Node_Str"),token.getKind());
    Assert.assertEquals(new Text("String_Node_Str"),token.getService());
    token=aliceUGI.getCredentials().getToken(new Text("String_Node_Str"));
    Assert.assertArrayEquals(aliceInfo.getKeytabURI().getBytes(StandardCharsets.UTF_8),token.getIdentifier());
    Assert.assertArrayEquals(aliceInfo.getKeytabURI().getBytes(StandardCharsets.UTF_8),token.getPassword());
    Assert.assertEquals(new Text("String_Node_Str"),token.getKind());
    Assert.assertEquals(new Text("String_Node_Str"),token.getService());
    Assert.assertSame(aliceUGI,ugiProvider.getConfiguredUGI(aliceInfo));
    ugiProvider.invalidCache();
    Assert.assertNotSame(aliceUGI,ugiProvider.getConfiguredUGI(aliceInfo));
  }
  finally {
    httpService.stopAndWait();
  }
}