#1752: simplifying the DNS implementation - switch to TCP + fixing the DNS integration test
This commit is contained in:
@@ -4,6 +4,7 @@ from primaite.simulator.network.hardware.nodes.computer import Computer
|
||||
from primaite.simulator.network.hardware.nodes.server import Server
|
||||
from primaite.simulator.system.services.dns_client import DNSClient
|
||||
from primaite.simulator.system.services.dns_server import DNSServer
|
||||
from primaite.simulator.system.services.service import ServiceOperatingState
|
||||
|
||||
|
||||
def test_dns_client_server(uc2_network):
|
||||
@@ -13,12 +14,17 @@ def test_dns_client_server(uc2_network):
|
||||
dns_client: DNSClient = client_1.software_manager.software["DNSClient"]
|
||||
dns_server: DNSServer = domain_controller.software_manager.software["DNSServer"]
|
||||
|
||||
# register a domain to web server
|
||||
dns_server.dns_register("real-domain.com", IPv4Address("192.168.1.12"))
|
||||
assert dns_client.operating_state == ServiceOperatingState.RUNNING
|
||||
assert dns_server.operating_state == ServiceOperatingState.RUNNING
|
||||
|
||||
dns_server.show()
|
||||
|
||||
dns_client.check_domain_exists(target_domain="real-domain.com", dest_ip_address=IPv4Address("192.168.1.14"))
|
||||
# fake domain should not be added to dns cache
|
||||
dns_client.check_domain_exists(
|
||||
target_domain="fake-domain.com", dest_ip_address=IPv4Address(domain_controller.ip_address)
|
||||
)
|
||||
assert dns_client.dns_cache.get("fake-domain.com", None) is None
|
||||
|
||||
# should register the domain in the client cache
|
||||
assert dns_client.dns_cache.get("real-domain.com") is not None
|
||||
# arcd.com is registered in dns server and should be saved to cache
|
||||
dns_client.check_domain_exists(target_domain="arcd.com", dest_ip_address=IPv4Address(domain_controller.ip_address))
|
||||
assert dns_client.dns_cache.get("arcd.com", None) is not None
|
||||
|
||||
Reference in New Issue
Block a user