Permalink
Browse files

add check for missing store

  • Loading branch information...
1 parent 0691960 commit 9c679202ce23aa8bbdc05a95c670b91db5e7fe16 Jonathan Traupman committed Feb 2, 2011
Showing with 16 additions and 0 deletions.
  1. +13 −0 clients/python/tests/test_client.py
  2. +3 −0 clients/python/voldemort/client.py
@@ -300,3 +300,16 @@ def test_raw_versions(self):
resp = s.get(1)
self.assertEquals(resp, [])
+
+ def test_missing_store(self):
+ """
+ Tests that we get an exception when we try to get a non-existent store.
+ """
+
+ try:
+ s = StoreClient('does-not-exist', [('localhost', 6666)])
+ except VoldemortException:
+ self.assertTrue(True)
+ return
+
+ self.assertTrue(False)
@@ -164,6 +164,9 @@ def __init__(self, store_name, bootstrap_urls, reconnect_interval = 500, conflic
self.request_count = 0
self.conflict_resolver = conflict_resolver
self.nodes, self.store = self._bootstrap_metadata(bootstrap_urls, store_name)
+ if not self.store:
+ raise VoldemortException("Cannot find store [%s] at %s" % (store_name, bootstrap_urls))
+
self.node_id = random.randint(0, len(self.nodes) - 1)
self.node_id, self.connection = self._reconnect()
self.reconnect_interval = reconnect_interval

0 comments on commit 9c67920

Please sign in to comment.