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

David Smiley updated SOLR-5089:
-------------------------------

    Fix Version/s:     (was: 4.7)
                   4.8

> OverseerCollectionProcessorTest does not fail on assertions thrown by mock 
> objects
> ----------------------------------------------------------------------------------
>
>                 Key: SOLR-5089
>                 URL: https://issues.apache.org/jira/browse/SOLR-5089
>             Project: Solr
>          Issue Type: Bug
>          Components: Tests
>            Reporter: Shalin Shekhar Mangar
>            Assignee: Shalin Shekhar Mangar
>             Fix For: 4.8
>
>
> The OverseerCollectionProcessorTest uses EasyMock for testing but the test 
> does not fail if the mock object throws assertions because of unexpected 
> method calls.
> For example, I modified the Overseer to NOT throw an exception if 
> maxShardsAllowedToCreate < requestedShardsToCreate. The mock objects logs an 
> exception with an AssertionError but the test still passes.
> {code}
>   [junit4]   2> 1158 T11 oas.SolrTestCaseJ4.setUp ###Starting 
> testNoReplicationCollectionNotCreatedDueToMaxShardsPerNodeAndNodesToCreateOnLimits
>    [junit4]   2> 1195 T12 oasc.OverseerCollectionProcessor.run Process 
> current queue of collection creations
>    [junit4]   2> 2215 T12 oasc.OverseerCollectionProcessor.run Overseer 
> Collection Processor: Get the message id:id message:{
>    [junit4]   2>          "replicationFactor":"1",
>    [junit4]   2>          "operation":"createcollection",
>    [junit4]   2>          "numShards":"8",
>    [junit4]   2>          "maxShardsPerNode":"2",
>    [junit4]   2>          "collection.configName":"myconfig",
>    [junit4]   2>          
> "createNodeSet":"localhost:8964_solr,localhost:8966_solr,localhost:8963_solr",
>    [junit4]   2>          "name":"mycollection"}
>    [junit4]   2> 2216 T12 oasc.OverseerCollectionProcessor.createCollection 
> Creating shard mycollection_shard1_replica1 as part of slice shard1 of 
> collection mycollection on localhost:8964_solr
>    [junit4]   2> 2242 T12 oasc.SolrException.log ERROR Collection 
> createcollection of createcollection failed:java.lang.AssertionError:
>    [junit4]   2>          Unexpected method call 
> submit(ShardRequest:{params=action=CREATE&name=mycollection_shard1_replica1&collection.configName=myconfig&collection=mycollection&shard=shard1&numShards=8&qt=%2Fadmin%2Fcores,
>  purpose=1, nResponses =0}, "localhost:8964/solr", 
> action=CREATE&name=mycollection_shard1_replica1&collection.configName=myconfig&collection=mycollection&shard=shard1&numShards=8&qt=%2Fadmin%2Fcores):
>    [junit4]   2>                at 
> org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:45)
>    [junit4]   2>                at 
> org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:73)
>    [junit4]   2>                at 
> org.easymock.internal.ClassProxyFactory$MockMethodInterceptor.intercept(ClassProxyFactory.java:69)
>    [junit4]   2>                at 
> org.apache.solr.handler.component.ShardHandler$$EnhancerByCGLIB$$27b6a726.submit(<generated>)
>    [junit4]   2>                at 
> org.apache.solr.cloud.OverseerCollectionProcessor.createCollection(OverseerCollectionProcessor.java:838)
>    [junit4]   2>                at 
> org.apache.solr.cloud.OverseerCollectionProcessor.processMessage(OverseerCollectionProcessor.java:175)
>    [junit4]   2>                at 
> org.apache.solr.cloud.OverseerCollectionProcessorTest$OverseerCollectionProcessorToBeTested.processMessage(OverseerCollectionProcessorTest.java:95)
>    [junit4]   2>                at 
> org.apache.solr.cloud.OverseerCollectionProcessor.run(OverseerCollectionProcessor.java:127)
>    [junit4]   2>                at java.lang.Thread.run(Thread.java:724)
>    [junit4]   2>
>    [junit4]   2> 2259 T12 oasc.OverseerCollectionProcessor.run Overseer 
> Collection Processor: Message id:id complete, response:{Operation 
> createcollection caused exception:=java.lang.AssertionError:
>    [junit4]   2>          Unexpected method call 
> submit(ShardRequest:{params=action=CREATE&name=mycollection_shard1_replica1&collection.configName=myconfig&collection=mycollection&shard=shard1&numShards=8&qt=%2Fadmin%2Fcores,
>  purpose=1, nResponses =0}, "localhost:8964/solr", 
> action=CREATE&name=mycollection_shard1_replica1&collection.configName=myconfig&collection=mycollection&shard=shard1&numShards=8&qt=%2Fadmin%2Fcores):,exception={msg=
>    [junit4]   2>          Unexpected method call 
> submit(ShardRequest:{params=action=CREATE&name=mycollection_shard1_replica1&collection.configName=myconfig&collection=mycollection&shard=shard1&numShards=8&qt=%2Fadmin%2Fcores,
>  purpose=1, nResponses =0}, "localhost:8964/solr", 
> action=CREATE&name=mycollection_shard1_replica1&collection.configName=myconfig&collection=mycollection&shard=shard1&numShards=8&qt=%2Fadmin%2Fcores):,rspCode=-1}}
>    [junit4]   2> 2307 T11 oas.SolrTestCaseJ4.tearDown ###Ending 
> testNoReplicationCollectionNotCreatedDueToMaxShardsPerNodeAndNodesToCreateOnLimits
>    [junit4] OK      1.28s | 
> OverseerCollectionProcessorTest.testNoReplicationCollectionNotCreatedDueToMaxShardsPerNodeAndNodesToCreateOnLimits
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to