-
Notifications
You must be signed in to change notification settings - Fork 24.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add used memory amount to CircuitBreakingException message (#22521) #22693
Conversation
@bumbu thanks for this! This looks pretty good, could you add a unit test to |
Hi @dakrone, I added an assertion to Also I tested only for the first part of the number value (aka testing only for I squashed the commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there's a compilation error, @bumbu otherwise this looks good, can you fix the error and then I'll merge this?
@@ -235,6 +235,9 @@ public void testConstantFactor() throws Exception { | |||
fail("should never reach this"); | |||
} catch (CircuitBreakingException cbe) { | |||
assertThat("breaker was tripped exactly twice", breaker.getTrippedCount(), equalTo(2L)); | |||
|
|||
long newUsed = (long)(breaker.getUsed() * breaker.getOverhead()); | |||
assertThat(cbe.getMessage().contains("would be [" + newUsed "/"), equalTo(true)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing a +
between newUsed
and "/"
, so it's not compiling currently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. I was sure that it's not possible to introduce bugs with such a small change... Lesson learned.
Hi @dakrone. |
@elasticmachine test this please |
Thanks @bumbu, I've merged this! |
Closes #22521
Tests don't check for the amount of used memory because that will tie-up the tests to the implementation.
From what I saw there are no tests to check that the used memory is calculated correctly, but it may be just my lack of knowledge of the codebase. Also it is out of the scope of original ticket.