From 6c8f61561119f8cff11ea143e550c613d801299d Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Thu, 6 Aug 2009 14:22:09 +0000
Subject: [PATCH] Add a test for partition repartition. Add a test for
 partition replication.

git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1225 71dcc9de-d417-0410-9af5-da40c76e7ee4
---
 neo/tests/functional/testCluster.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/neo/tests/functional/testCluster.py b/neo/tests/functional/testCluster.py
index 806eb6d1..cab13795 100644
--- a/neo/tests/functional/testCluster.py
+++ b/neo/tests/functional/testCluster.py
@@ -33,6 +33,32 @@ class ClusterTests(unittest.TestCase):
         finally:
             neo.stop()
 
+    def testClusterBreaksWithTwoNodes(self):
+        neo = NEOCluster(['test_neo1', 'test_neo2'], port_base=20000,
+                         partitions=2, master_node_count=1)
+        neoctl = neo.getNEOCTL()
+        neo.setupDB()
+        neo.start()
+        try:
+            self.assertEqual(neoctl.getClusterState(), protocol.RUNNING)
+            neo.killStorage()
+            neo.expectClusterState(protocol.VERIFYING)
+        finally:
+            neo.stop()
+
+    def testClusterDoesntBreakWithTwoNodesOneReplica(self):
+        neo = NEOCluster(['test_neo1', 'test_neo2'], port_base=20000,
+                         partitions=2, replicas=1, master_node_count=1)
+        neoctl = neo.getNEOCTL()
+        neo.setupDB()
+        neo.start()
+        try:
+            self.assertEqual(neoctl.getClusterState(), protocol.RUNNING)
+            neo.killStorage()
+            neo.expectClusterState(protocol.RUNNING)
+        finally:
+            neo.stop()
+
 def test_suite():
     return unittest.makeSuite(ClusterTests)
 
-- 
2.30.9