Setup for getting pages from the cluster.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
"""Testing the the cluster."""
|
||||
|
||||
from unittest import IsolatedAsyncioTestCase
|
||||
from uuid import uuid4
|
||||
from aiohttp import ClientSession
|
||||
from release_tests.support import ADDR
|
||||
from release_tests.support.cluster import Cluster
|
||||
|
||||
|
||||
@@ -24,3 +26,31 @@ class ClusterTC(IsolatedAsyncioTestCase):
|
||||
text = await resp.text()
|
||||
self.assertEqual(resp.status, 200, text)
|
||||
await cluster.stop()
|
||||
|
||||
async def test_server_numbers(self):
|
||||
"""Control the number of servers."""
|
||||
count = 3
|
||||
cluster = Cluster(num=count)
|
||||
self.assertEqual(len(cluster.servers), count)
|
||||
|
||||
async def test_set_translation_mocking(self):
|
||||
"""Is the translation mocking setup"""
|
||||
transurl = f"/{uuid4()}"
|
||||
reply = str(uuid4())
|
||||
cluster = Cluster(transurl=transurl, transreplies=[reply])
|
||||
await cluster.start()
|
||||
async with ClientSession() as session:
|
||||
url = f"http://{ADDR}:{cluster.translate.port}{transurl}"
|
||||
async with session.get(url) as resp:
|
||||
text = await resp.text()
|
||||
self.assertEqual(resp.status, 200, text)
|
||||
await cluster.stop()
|
||||
|
||||
async def test_get_responses(self):
|
||||
"""Get pulls responsre from each server"""
|
||||
count = 4
|
||||
cluster = Cluster(num=count)
|
||||
await cluster.start()
|
||||
resp = await cluster.get("/")
|
||||
self.assertEqual(len(resp), count)
|
||||
await cluster.stop()
|
||||
|
||||
Reference in New Issue
Block a user