Skip to content

Commit

Permalink
Fix checks and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kfaraz committed Dec 8, 2023
1 parent 737b796 commit aae788c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,20 +389,19 @@ public void testUserCredentials()

response = resource.deleteUser(mockHttpRequest(), AUTHENTICATOR_NAME, "druid");
Assert.assertEquals(200, response.getStatus());
/*

response = resource.getUser(mockHttpRequestNoAudit(), AUTHENTICATOR_NAME, "druid");
Assert.assertEquals(400, response.getStatus());
Assert.assertEquals(errorMapWithMsg("User [druid] does not exist."), response.getEntity());

response = resource.updateUserCredentials(
mockHttpRequest(),
mockHttpRequestNoAudit(),
AUTHENTICATOR_NAME,
"druid",
new BasicAuthenticatorCredentialUpdate("helloworld", null)
);
Assert.assertEquals(400, response.getStatus());
Assert.assertEquals(errorMapWithMsg("User [druid] does not exist."), response.getEntity());
*/
}

private HttpServletRequest mockHttpRequestNoAudit()
Expand All @@ -427,6 +426,9 @@ private HttpServletRequest mockHttpRequest()
new AuthenticationResult("id", "authorizer", "authBy", Collections.emptyMap())
).once();
EasyMock.expect(req.getRemoteAddr()).andReturn("127.0.0.1").once();
EasyMock.expect(req.getMethod()).andReturn("GET").once();
EasyMock.expect(req.getRequestURI()).andReturn("uri").once();
EasyMock.expect(req.getQueryString()).andReturn("a=b").once();
EasyMock.replay(req);

return req;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,6 @@ public void error(Throwable t, String message, Object... formatArgs)
logException(log::error, t, StringUtils.nonStrictFormat(message, formatArgs));
}

public void assertionError(String message, Object... formatArgs)
{
log.error("ASSERTION_ERROR: " + message, formatArgs);
}

public void debugSegments(@Nullable final Collection<DataSegment> segments, @Nullable String preamble)
{
if (log.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ private static int computeNumChangedSegments(List<String> segmentIds, int[] segm
for (int i = 0; i < segmentChanges.length; i++) {
int numUpdatedRows = segmentChanges[i];
if (numUpdatedRows < 0) {
log.assertionError(
"Negative number of rows updated for segment id [%s]: %d",
log.error(
"ASSERTION_ERROR: Negative number of rows updated for segment id [%s]: %d",
segmentIds.get(i),
numUpdatedRows
);
Expand Down

0 comments on commit aae788c

Please sign in to comment.