3737from restalchemy .dm import filters as dm_filters
3838from restalchemy .storage .sql import engines
3939
40+ from exordos_core .agent .universal .drivers .secret import cert as cert_driver
4041from exordos_core .agent .universal .drivers .secret import password as password_driver
4142from exordos_core .common import constants as c
4243from exordos_core .common import utils
@@ -1433,19 +1434,18 @@ def factory(hostname, ip_addresses=None, key=None):
14331434
14341435
14351436@pytest .fixture ()
1436- def agent_service (
1437+ def password_agent_service (
14371438 default_node : tp .Dict [str , tp .Any ],
14381439 user_api_client : iam_clients .GenesisCoreTestRESTClient ,
14391440):
14401441 agent_uuid = sys_uuid .UUID (default_node ["uuid" ])
14411442 orch_client = orch_db .DatabaseOrchClient ()
14421443 with tempfile .TemporaryDirectory () as temp_dir :
1443- temp_file_path = os .path .join (temp_dir , "password_target_fields.json" )
1444-
1445- with open (temp_file_path , "w" , encoding = "utf-8" ) as f :
1444+ passwords_temp_file_path = os .path .join (temp_dir , "password_target_fields.json" )
1445+ with open (passwords_temp_file_path , "w" , encoding = "utf-8" ) as f :
14461446 json .dump ({}, f , indent = 4 )
14471447
1448- p_d = password_driver .PasswordCapabilityDriver (temp_file_path )
1448+ p_d = password_driver .PasswordCapabilityDriver (passwords_temp_file_path )
14491449 caps_drivers = [
14501450 p_d ,
14511451 ]
@@ -1464,11 +1464,53 @@ def agent_service(
14641464 yield agent
14651465
14661466
1467+ @pytest .fixture ()
1468+ def cert_agent_service (
1469+ default_node : tp .Dict [str , tp .Any ],
1470+ user_api_client : iam_clients .GenesisCoreTestRESTClient ,
1471+ ):
1472+ agent_uuid = sys_uuid .UUID (default_node ["uuid" ])
1473+ orch_client = orch_db .DatabaseOrchClient ()
1474+ with tempfile .TemporaryDirectory () as temp_dir :
1475+ cert_temp_file_path = os .path .join (temp_dir , "cert_target_fields.json" )
1476+ with open (cert_temp_file_path , "w" , encoding = "utf-8" ) as f :
1477+ json .dump ({}, f , indent = 4 )
1478+ privkey_temp_file_path = os .path .join (temp_dir , "privkey.pem" )
1479+ c_d = cert_driver .CoreDNSCertificateCapabilityDriver (
1480+ user_api_base_url = c .DEFAULT_ROOT_ENDPOINT ,
1481+ username = c .DEFAULT_DNS_CERT_USERNAME ,
1482+ password = c .DEFAULT_DNS_CERT_PASSWORD ,
1483+ storage_path = cert_temp_file_path ,
1484+ private_key_path = privkey_temp_file_path ,
1485+ )
1486+ caps_drivers = [
1487+ c_d ,
1488+ ]
1489+ agent = ua_agent_service .UniversalAgentService (
1490+ system_uuid = agent_uuid ,
1491+ agent_uuid = agent_uuid ,
1492+ orch_client = orch_client ,
1493+ caps_drivers = caps_drivers ,
1494+ facts_drivers = [],
1495+ iter_min_period = 3 ,
1496+ payload_path = None ,
1497+ verify_node_on_register = False ,
1498+ )
1499+ agent ._setup ()
1500+ agent ._register_agent ()
1501+ yield agent
1502+
1503+
14671504@pytest .fixture ()
14681505def password_builder ():
14691506 yield secret_service .PasswordBuilder ()
14701507
14711508
1509+ @pytest .fixture ()
1510+ def certificate_builder ():
1511+ yield secret_service .CertificateBuilder ()
1512+
1513+
14721514@pytest .fixture ()
14731515def universal_scheduler ():
14741516 yield ua_scheduler_service .UniversalAgentSchedulerService (capabilities = ["*" ])
0 commit comments