[ 
https://issues.apache.org/jira/browse/SOLR-15807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17446091#comment-17446091
 ] 

Chris M. Hostetter commented on SOLR-15807:
-------------------------------------------

I'm not really worried about the queue exhausting the heap (although I did make 
it default to using a bounded queue and the {{close()}} method will "fail" the 
test on if the capacity was ever hit) but I mainly approached it this way 
because I want to _support_ being able to isolate some specific code and saying 
"this little snippet right here should produce N, and exactly N, log messages 
that match some pattern – so that a single test method can logically test a 
"sequence" of steps, and assert that it got diff log messages from diff 
snippets of code.

Also, something I alluded to in the parent task: if we have functionality (like 
this) in an {{AutoClosable}} wrapper, it should be trivial to implement a 
{{TestRule}} where the {{apply()}} method just wraps the statement in the 
AutoClosable (was going to tackle that in it's own sub-task later if needed)

(Ultimately, what i really want, is a {{\@ClassRule}} on {{SolrTestCase}} that 
fails the test if there was *ANY* ERROR or WARN that wasn't "expected" -- ie: 
didn't get popped off the queue by the test -- taking baby steps)

> Add a "LogInterceptor" helpe class that makes it easy to inspect & assert 
> expected log messages
> -----------------------------------------------------------------------------------------------
>
>                 Key: SOLR-15807
>                 URL: https://issues.apache.org/jira/browse/SOLR-15807
>             Project: Solr
>          Issue Type: Sub-task
>            Reporter: Chris M. Hostetter
>            Assignee: Chris M. Hostetter
>            Priority: Major
>         Attachments: SOLR-15807.patch
>
>
> Following on some of the ideas started/outlined in the parent task...
> we should have an easy way for a block of test code to "intercept" and make 
> assertions about log messages from specific loggers (at specific log levels, 
> matching specific substrings/regexes) that happen as a result of some actions 
> during the test code.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to