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

Vladislav Pyatkov updated IGNITE-19738:
---------------------------------------
    Description: 
*Motivation*
Everywhere in the test, we should give up explicitly waiting for future 
completion in favor of using matcher assert. This replacement is supposed to 
serve two purposes:
# Limit of waiting time
# Throw exception with useful message

h3. Examples
{code:java}
{fut.joi(), fut.get(), fur.get(5, TimeUnit.SECONDS)} -> assertThat("Waiting 
timeout of some particular future ran out", fut, 
willCompleteSuccessfully()){code}

*Implementation notes*
* Add a method that is waiting for a future result and, in addition, can return 
a future result in the test context:
{code}
T <T>CompletableFutureAssert#assertWillSuccess(CompletableFuture<T>)
{code}
A similar method for exception replay is already defined 
{{assertWillThrowFast}}. It requires renaming and changing the timeout.
{code}
<X extends Throwable> X 
CompletableFutureAssert#assertWillFail(CompletableFuture<?> future, Class<X> 
expectedExceptionClass)
{code}
Both methods use a timeout to wait for the result.
* willSucceedFast() must be removed (too short to use)
* Replace fut.get(), fut.join() to corresponding methods with timeout 
({{assertThat}}, {{assertThatSuccess}} or {{assertThatFail}}) where it is 
possible.
* Add remarks in the Ignite 3 code style about waiting futures in tests 
(https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide).

*Definition of done*
Everywhere in tests, futures are waiting with timeout.

 

  was:
*Motivation*
Everywhere in the test, we should give up explicitly waiting for future 
completion in favor of using matcher assert. This replacement is supposed to 
serve two purposes:
# Limit of waiting time
# Throw exception with useful message

h3. Examples
{code:java}
{fut.joi(), fut.get(), fur.get(5, TimeUnit.SECONDS)} -> assertThat("Waiting 
timeout of some particular future ran out", fut, 
willCompleteSuccessfully()){code}

*Implementation notes*
* Add a method that is waiting for a future result and, in addition, can return 
a future result in the test context:
{code}
T <T>CompletableFutureAssert#assertWillSuccess(CompletableFuture<T>)
{code}
A similar method for exception replay is already defined 
{{assertWillThrowFast}}. It requires renaming and changing the timeout.
{code}
Throwable CompletableFutureAssert#assertWillFail(CompletableFuture<?> future, 
Class<X> expectedExceptionClass)
{code}
Both methods use a timeout to wait for the result.
* willSucceedFast() must be removed (too short to use)
* Replace fut.get(), fut.join() to corresponding methods with timeout 
({{assertThat}}, {{assertThatSuccess}} or {{assertThatFail}}) where it is 
possible.
* Add remarks in the Ignite 3 code style about waiting futures in tests 
(https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide).

*Definition of done*
Everywhere in tests, futures are waiting with timeout.

 


> Replace fut.join() to assertThat(fut, willCompleteSuccessfully()) in all tests
> ------------------------------------------------------------------------------
>
>                 Key: IGNITE-19738
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19738
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Vladislav Pyatkov
>            Priority: Major
>              Labels: ignite-3
>
> *Motivation*
> Everywhere in the test, we should give up explicitly waiting for future 
> completion in favor of using matcher assert. This replacement is supposed to 
> serve two purposes:
> # Limit of waiting time
> # Throw exception with useful message
> h3. Examples
> {code:java}
> {fut.joi(), fut.get(), fur.get(5, TimeUnit.SECONDS)} -> assertThat("Waiting 
> timeout of some particular future ran out", fut, 
> willCompleteSuccessfully()){code}
> *Implementation notes*
> * Add a method that is waiting for a future result and, in addition, can 
> return a future result in the test context:
> {code}
> T <T>CompletableFutureAssert#assertWillSuccess(CompletableFuture<T>)
> {code}
> A similar method for exception replay is already defined 
> {{assertWillThrowFast}}. It requires renaming and changing the timeout.
> {code}
> <X extends Throwable> X 
> CompletableFutureAssert#assertWillFail(CompletableFuture<?> future, Class<X> 
> expectedExceptionClass)
> {code}
> Both methods use a timeout to wait for the result.
> * willSucceedFast() must be removed (too short to use)
> * Replace fut.get(), fut.join() to corresponding methods with timeout 
> ({{assertThat}}, {{assertThatSuccess}} or {{assertThatFail}}) where it is 
> possible.
> * Add remarks in the Ignite 3 code style about waiting futures in tests 
> (https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide).
> *Definition of done*
> Everywhere in tests, futures are waiting with timeout.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to