You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2016/10/05 20:54:18 UTC
Re: lucene-solr:master: SOLR-9132: RulesTest must tear down collections
at the end of each test
It's not immediately obvious to me why these collection deletions can't be
done in an @After method -- but if they need to live in each test method
can we at least have an @After method that asserts no collections exist
(via a STATUS call) so if someone writes a new test method but forgets to
delete that collection then the @After method will catch it and give them
a self explanatory failure instead of some future confusing/trappy error
that depends on test order or what not?
: Date: Wed, 5 Oct 2016 14:28:21 +0000 (UTC)
: From: romseygeek@apache.org
: Reply-To: dev@lucene.apache.org
: To: commits@lucene.apache.org
: Subject: lucene-solr:master: SOLR-9132: RulesTest must tear down collections
: at the end of each test
:
: Repository: lucene-solr
: Updated Branches:
: refs/heads/master b6610b9f0 -> d398617be
:
:
: SOLR-9132: RulesTest must tear down collections at the end of each test
:
:
: Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
: Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d398617b
: Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d398617b
: Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d398617b
:
: Branch: refs/heads/master
: Commit: d398617be891c9bc4ac72f85bf6ba4bff81f4f89
: Parents: b6610b9
: Author: Alan Woodward <ro...@apache.org>
: Authored: Wed Oct 5 15:18:46 2016 +0100
: Committer: Alan Woodward <ro...@apache.org>
: Committed: Wed Oct 5 15:19:22 2016 +0100
:
: ----------------------------------------------------------------------
: .../src/test/org/apache/solr/cloud/rule/RulesTest.java | 10 ++++++++++
: 1 file changed, 10 insertions(+)
: ----------------------------------------------------------------------
:
:
: http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d398617b/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java
: ----------------------------------------------------------------------
: diff --git a/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java b/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java
: index 1b74cbe..eec3d93 100644
: --- a/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java
: +++ b/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java
: @@ -80,6 +80,8 @@ public class RulesTest extends SolrCloudTestCase {
: CollectionAdminRequest.createShard(rulesColl, "shard2").process(cluster.getSolrClient());
: CollectionAdminRequest.addReplicaToShard(rulesColl, "shard2").process(cluster.getSolrClient());
:
: + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
: +
: }
:
: @Test
: @@ -102,6 +104,8 @@ public class RulesTest extends SolrCloudTestCase {
: list = (List) rulesCollection.get("snitch");
: assertEquals(1, list.size());
: assertEquals ( "ImplicitSnitch", ((Map)list.get(0)).get("class"));
: +
: + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
: }
:
: @Test
: @@ -129,6 +133,8 @@ public class RulesTest extends SolrCloudTestCase {
: list = (List) rulesCollection.get("snitch");
: assertEquals(1, list.size());
: assertEquals("ImplicitSnitch", list.get(0).get("class"));
: +
: + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
: }
:
:
: @@ -151,6 +157,8 @@ public class RulesTest extends SolrCloudTestCase {
: .setSnitch("class:ImplicitSnitch")
: .process(cluster.getSolrClient());
:
: + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
: +
: }
:
:
: @@ -192,5 +200,7 @@ public class RulesTest extends SolrCloudTestCase {
: list = (List) rulesCollection.get("snitch");
: assertEquals(1, list.size());
: assertEquals("ImplicitSnitch", ((Map) list.get(0)).get("class"));
: +
: + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
: }
: }
:
:
-Hoss
http://www.lucidworks.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: lucene-solr:master: SOLR-9132: RulesTest must tear down collections at the end of each test
Posted by Alan Woodward <al...@flax.co.uk>.
They all have different collection names, which is why we can’t do it in an @After method, but you’re right, it is trappy. How about instead we add a .deleteAllCollections() command to MiniSolrCloudCluster, which will ensure that each test starts up in an empty cluster?
Alan Woodward
www.flax.co.uk
> On 5 Oct 2016, at 21:54, Chris Hostetter <ho...@fucit.org> wrote:
>
>
> It's not immediately obvious to me why these collection deletions can't be
> done in an @After method -- but if they need to live in each test method
> can we at least have an @After method that asserts no collections exist
> (via a STATUS call) so if someone writes a new test method but forgets to
> delete that collection then the @After method will catch it and give them
> a self explanatory failure instead of some future confusing/trappy error
> that depends on test order or what not?
>
>
>
> : Date: Wed, 5 Oct 2016 14:28:21 +0000 (UTC)
> : From: romseygeek@apache.org
> : Reply-To: dev@lucene.apache.org
> : To: commits@lucene.apache.org
> : Subject: lucene-solr:master: SOLR-9132: RulesTest must tear down collections
> : at the end of each test
> :
> : Repository: lucene-solr
> : Updated Branches:
> : refs/heads/master b6610b9f0 -> d398617be
> :
> :
> : SOLR-9132: RulesTest must tear down collections at the end of each test
> :
> :
> : Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
> : Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d398617b
> : Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d398617b
> : Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d398617b
> :
> : Branch: refs/heads/master
> : Commit: d398617be891c9bc4ac72f85bf6ba4bff81f4f89
> : Parents: b6610b9
> : Author: Alan Woodward <ro...@apache.org>
> : Authored: Wed Oct 5 15:18:46 2016 +0100
> : Committer: Alan Woodward <ro...@apache.org>
> : Committed: Wed Oct 5 15:19:22 2016 +0100
> :
> : ----------------------------------------------------------------------
> : .../src/test/org/apache/solr/cloud/rule/RulesTest.java | 10 ++++++++++
> : 1 file changed, 10 insertions(+)
> : ----------------------------------------------------------------------
> :
> :
> : http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d398617b/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java
> : ----------------------------------------------------------------------
> : diff --git a/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java b/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java
> : index 1b74cbe..eec3d93 100644
> : --- a/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java
> : +++ b/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java
> : @@ -80,6 +80,8 @@ public class RulesTest extends SolrCloudTestCase {
> : CollectionAdminRequest.createShard(rulesColl, "shard2").process(cluster.getSolrClient());
> : CollectionAdminRequest.addReplicaToShard(rulesColl, "shard2").process(cluster.getSolrClient());
> :
> : + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
> : +
> : }
> :
> : @Test
> : @@ -102,6 +104,8 @@ public class RulesTest extends SolrCloudTestCase {
> : list = (List) rulesCollection.get("snitch");
> : assertEquals(1, list.size());
> : assertEquals ( "ImplicitSnitch", ((Map)list.get(0)).get("class"));
> : +
> : + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
> : }
> :
> : @Test
> : @@ -129,6 +133,8 @@ public class RulesTest extends SolrCloudTestCase {
> : list = (List) rulesCollection.get("snitch");
> : assertEquals(1, list.size());
> : assertEquals("ImplicitSnitch", list.get(0).get("class"));
> : +
> : + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
> : }
> :
> :
> : @@ -151,6 +157,8 @@ public class RulesTest extends SolrCloudTestCase {
> : .setSnitch("class:ImplicitSnitch")
> : .process(cluster.getSolrClient());
> :
> : + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
> : +
> : }
> :
> :
> : @@ -192,5 +200,7 @@ public class RulesTest extends SolrCloudTestCase {
> : list = (List) rulesCollection.get("snitch");
> : assertEquals(1, list.size());
> : assertEquals("ImplicitSnitch", ((Map) list.get(0)).get("class"));
> : +
> : + CollectionAdminRequest.deleteCollection(rulesColl).process(cluster.getSolrClient());
> : }
> : }
> :
> :
>
> -Hoss
> http://www.lucidworks.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>