Add test script

This commit is contained in:
2025-07-11 13:51:39 +08:00
parent 4089f70574
commit 488f289315
3 changed files with 79 additions and 4 deletions

View File

@ -47,7 +47,7 @@ class Manager:
"""
self.services_list.append(service_instance)
def register_service(self, service_tag: str, service_name: str, service_path: str) -> Service:
def register_service(self, service_tag: str, service_name: str, service_path=None) -> Service:
"""Register a new service.
Args:
@ -58,7 +58,9 @@ class Manager:
Returns:
service: A web service instance.
"""
if service_tag == "docker":
assert service_path != None, """Can not leave a empty path while you register a docker-deploy service."""
if not os.path.exists(service_path):
raise ValueError(f"Invalid service path: {service_path}")
service = Service(tag=service_tag, name=service_name, path=service_path)

View File

@ -41,9 +41,9 @@ class Service:
"""A template management for web services
Attributes:
tag ('sys' | 'docker'): The tag that marks the service instance to use which way to deploy.
name (str): The name of the service instance.
path (str): The configuration and data path of the service instance.
_tag ('sys' | 'docker'): The tag that marks the service instance to use which way to deploy.
_name (str): The name of the service instance.
_path (str): The configuration and data path of the service instance.
"""
def __init__(self, tag: str, name: str, path=None):