From dc549abbc46713aebc498f23718e1a05d71f8103 Mon Sep 17 00:00:00 2001 From: Zhihao Yuan Date: Fri, 20 Sep 2013 13:57:36 -0400 Subject: [PATCH] test(proxy): fix proxy-transport tests Change-Id: Ibc05d6949221367a21b493f75ff0b4f0350ee265 --- requirements.txt | 1 - tests/unit/proxy/test_catalog.py | 8 ++------ tests/unit/proxy/test_partitions.py | 10 +++++----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index fd426bf42..aaa3a0b57 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,6 @@ msgpack-python pymongo>=2.4 python-keystoneclient>=0.3.2 python-memcached -redis simplejson>=2.0.9 WebOb>=1.2.3,<1.3 stevedore>=0.10 diff --git a/tests/unit/proxy/test_catalog.py b/tests/unit/proxy/test_catalog.py index 879772d2f..c84b8a9a5 100644 --- a/tests/unit/proxy/test_catalog.py +++ b/tests/unit/proxy/test_catalog.py @@ -18,7 +18,6 @@ import json import random import falcon -import redis from marconi.queues import bootstrap @@ -47,10 +46,7 @@ class CatalogTest(base.TestBase): for server in self.servers: self.simulate_delete('/v1/partitions/' + server.name) - # TODO(zyuan): replace this with an proxy-storage - # API call to clean up the catalogs - client = redis.StrictRedis() - client.flushdb() + # TODO(zyuan): use a storage API call to cleanup the catalogs super(CatalogTest, self).tearDown() @@ -59,7 +55,7 @@ class CatalogTest(base.TestBase): [server.name for server in self.servers], self.urls, random.sample(xrange(100), len(self.urls))): - doc = {'nodes': [url], 'weight': weight} + doc = {'hosts': [url], 'weight': weight} self.simulate_put('/v1/partitions/' + name, body=json.dumps(doc)) self.assertEquals(self.srmock.status, falcon.HTTP_201) diff --git a/tests/unit/proxy/test_partitions.py b/tests/unit/proxy/test_partitions.py index e54f829e6..b96c049e5 100644 --- a/tests/unit/proxy/test_partitions.py +++ b/tests/unit/proxy/test_partitions.py @@ -38,7 +38,7 @@ class PartitionTest(base.TestBase): self.simulate_get(self.partition) self.assertEquals(self.srmock.status, falcon.HTTP_404) - doc = {'nodes': ['url'], + doc = {'hosts': ['url'], 'weight': 10} # Create @@ -74,7 +74,7 @@ class PartitionTest(base.TestBase): # Insert for n in range(1, 11): - doc = {'nodes': map(str, range(n)), + doc = {'hosts': map(str, range(n)), 'weight': n} self.simulate_put(self.partition + str(n), @@ -100,8 +100,8 @@ class PartitionTest(base.TestBase): self.assertEquals(self.srmock.status, falcon.HTTP_400) # Bad fields - invalid_nodes = [1, {}, {'nodes': 1}, {'nodes': []}] - invalid_weights = [{'nodes': ['url']}] + invalid_nodes = [1, {}, {'hosts': 1}, {'hosts': []}] + invalid_weights = [{'hosts': ['url']}] invalid_weights.append(copy.copy(invalid_weights[0])) invalid_weights[1]['weight'] = 3.14 @@ -111,7 +111,7 @@ class PartitionTest(base.TestBase): self.assertEquals(self.srmock.status, falcon.HTTP_400) def test_reserved_partition(self): - doc = {'nodes': ['url'], + doc = {'hosts': ['url'], 'weight': 10} self.simulate_put('/v1/partitions/__cplusplus',