26 lines
969 B
Python
26 lines
969 B
Python
|
|
"""Testing the the cluster."""
|
||
|
|
|
||
|
|
from unittest import IsolatedAsyncioTestCase
|
||
|
|
from aiohttp import ClientSession
|
||
|
|
from release_tests.support.cluster import Cluster
|
||
|
|
|
||
|
|
class ClusterTC(IsolatedAsyncioTestCase):
|
||
|
|
"""Test for the MoreThanText cluster."""
|
||
|
|
|
||
|
|
async def test_create_default_cluster(self):
|
||
|
|
"""create a complete two server cluster."""
|
||
|
|
cluster = Cluster()
|
||
|
|
await cluster.start()
|
||
|
|
async with ClientSession() as session:
|
||
|
|
url = cluster.translate.baseurl
|
||
|
|
async with session.get(url) as resp:
|
||
|
|
text = await resp.text()
|
||
|
|
self.assertEqual(resp.status, 200, text)
|
||
|
|
self.assertEqual(len(cluster.servers), 2)
|
||
|
|
for server in cluster.servers:
|
||
|
|
url = server.baseurl
|
||
|
|
async with session.get(url) as resp:
|
||
|
|
text = await resp.text()
|
||
|
|
self.assertEqual(resp.status, 200, text)
|
||
|
|
await cluster.stop()
|