test(proxy): fix proxy-transport tests
Change-Id: Ibc05d6949221367a21b493f75ff0b4f0350ee265
This commit is contained in:
parent
ca26627ec4
commit
dc549abbc4
@ -8,7 +8,6 @@ msgpack-python
|
|||||||
pymongo>=2.4
|
pymongo>=2.4
|
||||||
python-keystoneclient>=0.3.2
|
python-keystoneclient>=0.3.2
|
||||||
python-memcached
|
python-memcached
|
||||||
redis
|
|
||||||
simplejson>=2.0.9
|
simplejson>=2.0.9
|
||||||
WebOb>=1.2.3,<1.3
|
WebOb>=1.2.3,<1.3
|
||||||
stevedore>=0.10
|
stevedore>=0.10
|
||||||
|
@ -18,7 +18,6 @@ import json
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
import falcon
|
import falcon
|
||||||
import redis
|
|
||||||
|
|
||||||
from marconi.queues import bootstrap
|
from marconi.queues import bootstrap
|
||||||
|
|
||||||
@ -47,10 +46,7 @@ class CatalogTest(base.TestBase):
|
|||||||
for server in self.servers:
|
for server in self.servers:
|
||||||
self.simulate_delete('/v1/partitions/' + server.name)
|
self.simulate_delete('/v1/partitions/' + server.name)
|
||||||
|
|
||||||
# TODO(zyuan): replace this with an proxy-storage
|
# TODO(zyuan): use a storage API call to cleanup the catalogs
|
||||||
# API call to clean up the catalogs
|
|
||||||
client = redis.StrictRedis()
|
|
||||||
client.flushdb()
|
|
||||||
|
|
||||||
super(CatalogTest, self).tearDown()
|
super(CatalogTest, self).tearDown()
|
||||||
|
|
||||||
@ -59,7 +55,7 @@ class CatalogTest(base.TestBase):
|
|||||||
[server.name for server in self.servers],
|
[server.name for server in self.servers],
|
||||||
self.urls,
|
self.urls,
|
||||||
random.sample(xrange(100), len(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,
|
self.simulate_put('/v1/partitions/' + name,
|
||||||
body=json.dumps(doc))
|
body=json.dumps(doc))
|
||||||
self.assertEquals(self.srmock.status, falcon.HTTP_201)
|
self.assertEquals(self.srmock.status, falcon.HTTP_201)
|
||||||
|
@ -38,7 +38,7 @@ class PartitionTest(base.TestBase):
|
|||||||
self.simulate_get(self.partition)
|
self.simulate_get(self.partition)
|
||||||
self.assertEquals(self.srmock.status, falcon.HTTP_404)
|
self.assertEquals(self.srmock.status, falcon.HTTP_404)
|
||||||
|
|
||||||
doc = {'nodes': ['url'],
|
doc = {'hosts': ['url'],
|
||||||
'weight': 10}
|
'weight': 10}
|
||||||
|
|
||||||
# Create
|
# Create
|
||||||
@ -74,7 +74,7 @@ class PartitionTest(base.TestBase):
|
|||||||
|
|
||||||
# Insert
|
# Insert
|
||||||
for n in range(1, 11):
|
for n in range(1, 11):
|
||||||
doc = {'nodes': map(str, range(n)),
|
doc = {'hosts': map(str, range(n)),
|
||||||
'weight': n}
|
'weight': n}
|
||||||
|
|
||||||
self.simulate_put(self.partition + str(n),
|
self.simulate_put(self.partition + str(n),
|
||||||
@ -100,8 +100,8 @@ class PartitionTest(base.TestBase):
|
|||||||
self.assertEquals(self.srmock.status, falcon.HTTP_400)
|
self.assertEquals(self.srmock.status, falcon.HTTP_400)
|
||||||
|
|
||||||
# Bad fields
|
# Bad fields
|
||||||
invalid_nodes = [1, {}, {'nodes': 1}, {'nodes': []}]
|
invalid_nodes = [1, {}, {'hosts': 1}, {'hosts': []}]
|
||||||
invalid_weights = [{'nodes': ['url']}]
|
invalid_weights = [{'hosts': ['url']}]
|
||||||
invalid_weights.append(copy.copy(invalid_weights[0]))
|
invalid_weights.append(copy.copy(invalid_weights[0]))
|
||||||
invalid_weights[1]['weight'] = 3.14
|
invalid_weights[1]['weight'] = 3.14
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class PartitionTest(base.TestBase):
|
|||||||
self.assertEquals(self.srmock.status, falcon.HTTP_400)
|
self.assertEquals(self.srmock.status, falcon.HTTP_400)
|
||||||
|
|
||||||
def test_reserved_partition(self):
|
def test_reserved_partition(self):
|
||||||
doc = {'nodes': ['url'],
|
doc = {'hosts': ['url'],
|
||||||
'weight': 10}
|
'weight': 10}
|
||||||
|
|
||||||
self.simulate_put('/v1/partitions/__cplusplus',
|
self.simulate_put('/v1/partitions/__cplusplus',
|
||||||
|
Loading…
Reference in New Issue
Block a user