[ 
https://issues.apache.org/jira/browse/SOLR-15815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chris M. Hostetter updated SOLR-15815:
--------------------------------------
    Attachment: SOLR-15815.patch
        Status: Open  (was: Open)

Spurred on by a question from smiley in SOLR-15807, here's a quick and dirty 
patch showing what i had in mind for how the LogListener and ErrorLogMuter 
functionality defined in sibling sub-tasks could be exposed as TestRules in the 
situations where we want to say things like "mute all errors mentioinging XYZ 
in all test methods in this test class" or "listen to all error logs for all 
test methods in this class, and fail any tests that produce errors that aren't 
explicitly expected (and popped off the queue)"

The basic impl is a {{CloseableResourceRule}} that takes in a {{Supplier<X 
extends AutoCloseable>}} (so it can easily be passed a lambda returning 
something implementiong AutoClosable) and for each statement evalaution it 
calls the supplier before the test statement is evaluated, and  closes it when 
done.  During the statement evaluation, the instance is accessible from a 
simple {{get()}} method (ie: for inspecting the queue of the {{LogListener}} 
Convinience helper factory methods for the most common LogListener & 
ErrorLogMuter use cases can be provided, but more complex cases can pass their 
own lambda to {{CloseableResourceRule.create(...)}}

> Add TestRule support for ErrorLogMuter & LogListener
> ----------------------------------------------------
>
>                 Key: SOLR-15815
>                 URL: https://issues.apache.org/jira/browse/SOLR-15815
>             Project: Solr
>          Issue Type: Sub-task
>            Reporter: Chris M. Hostetter
>            Priority: Major
>         Attachments: SOLR-15815.patch
>
>
> sibling sub-tasks implement log muting & inspection helpers that work by 
> implementing AutoClosable, as discussed in parent task we should also expose 
> this functionality in a TestRule



--
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