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

Mirza Aliev updated IGNITE-24238:
---------------------------------
    Description: 
{{ItIgniteDistributionZoneManagerNodeRestartTest#testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful}}
 is flaky with 


{noformat}
org.mockito.exceptions.misusing.UnfinishedStubbingException: 
Unfinished stubbing detected here:
-> at 
org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:642)

E.g. thenReturn() may be missing.
Examples of correct stubbing:
    when(mock.isOk()).thenReturn(true);
    when(mock.isOk()).thenThrow(exception);
    doThrow(exception).when(mock).someVoidMethod();
Hints:
 1. missing thenReturn()
 2. you are trying to stub a final method, which is not supported
 3. you are stubbing the behaviour of another mock inside before 'thenReturn' 
instruction is completed
org.mockito.exceptions.misusing.UnfinishedStubbingException:
Unfinished stubbing detected here:
-> at 
org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:642)
E.g. thenReturn() may be missing.
Examples of correct stubbing:
    when(mock.isOk()).thenReturn(true);
    when(mock.isOk()).thenThrow(exception);
    doThrow(exception).when(mock).someVoidMethod();
Hints:
 1. missing thenReturn()
 2. you are trying to stub a final method, which is not supported
 3. you are stubbing the behaviour of another mock inside before 'thenReturn' 
instruction is completed
  at 
app//org.apache.ignite.internal.metastorage.impl.MetaStorageManagerImpl.invoke(MetaStorageManagerImpl.java:991)
  at 
app//org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:651)
  at java.base@17.0.6/java.lang.reflect.Method.invoke(Method.java:568)
  at java.base@17.0.6/java.util.ArrayList.forEach(ArrayList.java:1511)
  at java.base@17.0.6/java.util.ArrayList.forEach(ArrayList.java:1511)

{noformat}

It seems that we have some concurrent access to MS that is supposed to be 
stubed.

Form Mockito docs: 

{noformat}
However Mockito is only thread-safe in healthy tests, that is tests without 
multiple threads stubbing/verifying a shared mock. Stubbing or verification of 
a shared mock from different threads is NOT the proper way of testing because 
it will always lead to intermittent behavior. 
In general, mutable state + assertions in multi-threaded environment lead to 
random results. If you do stub/verify a shared mock across threads you will 
face occasional exceptions like: WrongTypeOfReturnValue, etc.*
{noformat}


  was:
{{ItIgniteDistributionZoneManagerNodeRestartTest#testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful}}
 is flaky with 


{noformat}
org.mockito.exceptions.misusing.UnfinishedStubbingException: 
Unfinished stubbing detected here:
-> at 
org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:642)

E.g. thenReturn() may be missing.
Examples of correct stubbing:
    when(mock.isOk()).thenReturn(true);
    when(mock.isOk()).thenThrow(exception);
    doThrow(exception).when(mock).someVoidMethod();
Hints:
 1. missing thenReturn()
 2. you are trying to stub a final method, which is not supported
 3. you are stubbing the behaviour of another mock inside before 'thenReturn' 
instruction is completed
org.mockito.exceptions.misusing.UnfinishedStubbingException:
Unfinished stubbing detected here:
-> at 
org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:642)
E.g. thenReturn() may be missing.
Examples of correct stubbing:
    when(mock.isOk()).thenReturn(true);
    when(mock.isOk()).thenThrow(exception);
    doThrow(exception).when(mock).someVoidMethod();
Hints:
 1. missing thenReturn()
 2. you are trying to stub a final method, which is not supported
 3. you are stubbing the behaviour of another mock inside before 'thenReturn' 
instruction is completed
  at 
app//org.apache.ignite.internal.metastorage.impl.MetaStorageManagerImpl.invoke(MetaStorageManagerImpl.java:991)
  at 
app//org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:651)
  at java.base@17.0.6/java.lang.reflect.Method.invoke(Method.java:568)
  at java.base@17.0.6/java.util.ArrayList.forEach(ArrayList.java:1511)
  at java.base@17.0.6/java.util.ArrayList.forEach(ArrayList.java:1511)

{noformat}

It seems that we have some concurrent access to MS that is supposed to be 
stubed.

Form Mockito docs: 

{noformat}
*However Mockito is only thread-safe in healthy tests, that is tests without 
multiple threads stubbing/verifying a shared mock. Stubbing or verification of 
a shared mock from different threads is NOT the proper way of testing because 
it will always lead to intermittent behavior. In general, mutable state + 
assertions in multi-threaded environment lead to random results. If you do 
stub/verify a shared mock across threads you will face occasional exceptions 
like: WrongTypeOfReturnValue, etc.*
{noformat}



> ItIgniteDistributionZoneManagerNodeRestartTest#testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful
>   
> -------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-24238
>                 URL: https://issues.apache.org/jira/browse/IGNITE-24238
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Mirza Aliev
>            Priority: Major
>              Labels: ignite-3
>
> {{ItIgniteDistributionZoneManagerNodeRestartTest#testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful}}
>  is flaky with 
> {noformat}
> org.mockito.exceptions.misusing.UnfinishedStubbingException: 
> Unfinished stubbing detected here:
> -> at 
> org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:642)
> E.g. thenReturn() may be missing.
> Examples of correct stubbing:
>     when(mock.isOk()).thenReturn(true);
>     when(mock.isOk()).thenThrow(exception);
>     doThrow(exception).when(mock).someVoidMethod();
> Hints:
>  1. missing thenReturn()
>  2. you are trying to stub a final method, which is not supported
>  3. you are stubbing the behaviour of another mock inside before 'thenReturn' 
> instruction is completed
> org.mockito.exceptions.misusing.UnfinishedStubbingException:
> Unfinished stubbing detected here:
> -> at 
> org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:642)
> E.g. thenReturn() may be missing.
> Examples of correct stubbing:
>     when(mock.isOk()).thenReturn(true);
>     when(mock.isOk()).thenThrow(exception);
>     doThrow(exception).when(mock).someVoidMethod();
> Hints:
>  1. missing thenReturn()
>  2. you are trying to stub a final method, which is not supported
>  3. you are stubbing the behaviour of another mock inside before 'thenReturn' 
> instruction is completed
>   at 
> app//org.apache.ignite.internal.metastorage.impl.MetaStorageManagerImpl.invoke(MetaStorageManagerImpl.java:991)
>   at 
> app//org.apache.ignite.internal.distributionzones.ItIgniteDistributionZoneManagerNodeRestartTest.testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful(ItIgniteDistributionZoneManagerNodeRestartTest.java:651)
>   at java.base@17.0.6/java.lang.reflect.Method.invoke(Method.java:568)
>   at java.base@17.0.6/java.util.ArrayList.forEach(ArrayList.java:1511)
>   at java.base@17.0.6/java.util.ArrayList.forEach(ArrayList.java:1511)
> {noformat}
> It seems that we have some concurrent access to MS that is supposed to be 
> stubed.
> Form Mockito docs: 
> {noformat}
> However Mockito is only thread-safe in healthy tests, that is tests without 
> multiple threads stubbing/verifying a shared mock. Stubbing or verification 
> of a shared mock from different threads is NOT the proper way of testing 
> because it will always lead to intermittent behavior. 
> In general, mutable state + assertions in multi-threaded environment lead to 
> random results. If you do stub/verify a shared mock across threads you will 
> face occasional exceptions like: WrongTypeOfReturnValue, etc.*
> {noformat}



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

Reply via email to