[ 
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 test, we should give up explicitly waiting of future completion 
in favor of using matcher assert. This replacement is supposed to do for two 
purpose:
 # 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 two methods which are waiting a future with and in additional can return 
a future result (or exception) in test context:
{code}
T <T>assertThatSuccess(String, CompletableFuture<T>)
Throwable assertThatFail(String, CompletableFuture<T>)
{code}
Both the methods are used a timeout to wait 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 test, we should give up explicitly waiting of future completion 
in favor of using matcher assert. This replacement is supposed to do for two 
purpose:
 # 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 two methods which are waiting a future with and in additional can return 
a future result (or exception) in test context:
{code}
T <T>assertThatSuccess(String, CompletableFuture<T>)
Throwable assertThatFail(String, CompletableFuture<T>)
{code}
Both the methods are used a timeout to wait 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).

 


> 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: Bug
>            Reporter: Vladislav Pyatkov
>            Priority: Major
>              Labels: ignite-3
>
> *Motivation*
> Everywhere in test, we should give up explicitly waiting of future completion 
> in favor of using matcher assert. This replacement is supposed to do for two 
> purpose:
>  # 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 two methods which are waiting a future with and in additional can 
> return a future result (or exception) in test context:
> {code}
> T <T>assertThatSuccess(String, CompletableFuture<T>)
> Throwable assertThatFail(String, CompletableFuture<T>)
> {code}
> Both the methods are used a timeout to wait 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