2024-02-26 08:41:24 -05:00
|
|
|
"""Tests for single server boot ups."""
|
|
|
|
|
2024-03-04 11:21:42 -05:00
|
|
|
from .mtt_tc import MTTClusterTC
|
2024-02-29 18:46:01 -05:00
|
|
|
from socket import gethostbyname, gethostname
|
2024-02-26 08:41:24 -05:00
|
|
|
|
2024-02-29 11:20:20 -05:00
|
|
|
|
2024-03-04 11:21:42 -05:00
|
|
|
class BootUpTC(MTTClusterTC):
|
|
|
|
"""Single server boot tests."""
|
2024-02-29 11:20:20 -05:00
|
|
|
|
|
|
|
async def test_default_boot(self):
|
2024-03-04 11:21:42 -05:00
|
|
|
"""Does the server default boot on http://localhost:3000?"""
|
|
|
|
await self.create_server_with_flags()
|
|
|
|
def tests(response):
|
|
|
|
"""Response tests."""
|
|
|
|
self.assertEqual(response.status, 200)
|
|
|
|
await self.run_tests("/", tests)
|
2024-02-29 11:20:20 -05:00
|
|
|
|
|
|
|
async def test_alt_port_boot(self):
|
|
|
|
"""Can the server boot off on alternate port?"""
|
|
|
|
port = 9025
|
2024-03-04 11:21:42 -05:00
|
|
|
await self.create_server_with_flags("-p", str(port))
|
|
|
|
def tests(response):
|
|
|
|
"""Response tests."""
|
|
|
|
self.assertEqual(response.status, 200)
|
|
|
|
await self.run_tests("/", tests)
|
2024-02-29 18:46:01 -05:00
|
|
|
|
|
|
|
async def test_alt_address_boot(self):
|
|
|
|
"""Can it boot off an alternate address?"""
|
|
|
|
addr = gethostbyname(gethostname())
|
2024-03-04 11:21:42 -05:00
|
|
|
await self.create_server_with_flags("-a", addr)
|
|
|
|
def tests(response):
|
|
|
|
"""Response tests."""
|
|
|
|
self.assertEqual(response.status, 200)
|
|
|
|
await self.run_tests("/", tests)
|
|
|
|
|
|
|
|
async def test_for_session_id(self):
|
|
|
|
await self.create_server()
|
|
|
|
def tests(response):
|
|
|
|
"""Response tests."""
|
|
|
|
self.assertEqual(response.status, 200)
|
|
|
|
await self.run_tests("/", tests)
|
|
|
|
self.assertEqual(len(self.jar), 1, "There should be a session id.")
|