Fix IOU tests

This commit is contained in:
grossmj 2026-03-12 14:18:35 +08:00
parent 27ce1a4e25
commit 3abecc8492
No known key found for this signature in database
GPG Key ID: 1E7DD6DBB53FF3D7
4 changed files with 11 additions and 11 deletions

View File

@ -39,7 +39,7 @@ class IOUBase(BaseModel):
ram: Optional[int] = Field(None, gt=0, description="Amount of RAM in MB") ram: Optional[int] = Field(None, gt=0, description="Amount of RAM in MB")
nvram: Optional[int] = Field(None, gt=0, description="Amount of NVRAM in KB") nvram: Optional[int] = Field(None, gt=0, description="Amount of NVRAM in KB")
l1_keepalives: Optional[bool] = Field(None, description="Use default IOU values") l1_keepalives: Optional[bool] = Field(None, description="Use default IOU values")
use_default_iou_values: Optional[bool] = Field(None, description="Always up Ethernet interfaces") use_default_iou_values: Optional[bool] = Field(None, description="Use default IOU values")
startup_config_content: Optional[str] = Field(None, description="Content of IOU startup configuration file") startup_config_content: Optional[str] = Field(None, description="Content of IOU startup configuration file")
private_config_content: Optional[str] = Field(None, description="Content of IOU private configuration file") private_config_content: Optional[str] = Field(None, description="Content of IOU private configuration file")

View File

@ -30,9 +30,9 @@ class IOUTemplate(TemplateBase):
path: str = Field(..., description="Path of IOU executable") path: str = Field(..., description="Path of IOU executable")
ethernet_adapters: Optional[int] = Field(2, ge=0, description="Number of ethernet adapters") ethernet_adapters: Optional[int] = Field(2, ge=0, description="Number of ethernet adapters")
serial_adapters: Optional[int] = Field(2, ge=0, description="Number of serial adapters") serial_adapters: Optional[int] = Field(2, ge=0, description="Number of serial adapters")
ram: Optional[int] = Field(256, gt=0, description="Amount of RAM in MB") ram: Optional[int] = Field(1024, gt=0, description="Amount of RAM in MB")
nvram: Optional[int] = Field(128, gt=0, description="Amount of NVRAM in KB") nvram: Optional[int] = Field(256, gt=0, description="Amount of NVRAM in KB")
use_default_iou_values: Optional[bool] = Field(True, description="Use default IOU values") use_default_iou_values: Optional[bool] = Field(False, description="Use default IOU values")
startup_config: Optional[str] = Field("iou_l3_base_startup-config.txt", description="Startup-config of IOU") startup_config: Optional[str] = Field("iou_l3_base_startup-config.txt", description="Startup-config of IOU")
private_config: Optional[str] = Field("", description="Private-config of IOU") private_config: Optional[str] = Field("", description="Private-config of IOU")
l1_keepalives: Optional[bool] = Field(False, description="Always keep up Ethernet interface (does not always work)") l1_keepalives: Optional[bool] = Field(False, description="Always keep up Ethernet interface (does not always work)")

View File

@ -86,8 +86,8 @@ class TestIOUNodesRoutes:
assert response.json()["project_id"] == compute_project.id assert response.json()["project_id"] == compute_project.id
assert response.json()["serial_adapters"] == 2 assert response.json()["serial_adapters"] == 2
assert response.json()["ethernet_adapters"] == 2 assert response.json()["ethernet_adapters"] == 2
assert response.json()["ram"] == 256 assert response.json()["ram"] == 1024
assert response.json()["nvram"] == 128 assert response.json()["nvram"] == 256
assert response.json()["l1_keepalives"] is False assert response.json()["l1_keepalives"] is False
@ -190,8 +190,8 @@ class TestIOUNodesRoutes:
assert response.json()["project_id"] == compute_project.id assert response.json()["project_id"] == compute_project.id
assert response.json()["serial_adapters"] == 2 assert response.json()["serial_adapters"] == 2
assert response.json()["ethernet_adapters"] == 2 assert response.json()["ethernet_adapters"] == 2
assert response.json()["ram"] == 256 assert response.json()["ram"] == 1024
assert response.json()["nvram"] == 128 assert response.json()["nvram"] == 256
assert response.json()["l1_keepalives"] is False assert response.json()["l1_keepalives"] is False

View File

@ -718,14 +718,14 @@ class TestIOUTemplate:
"default_name_format": "IOU{0}", "default_name_format": "IOU{0}",
"ethernet_adapters": 2, "ethernet_adapters": 2,
"name": "IOU template", "name": "IOU template",
"nvram": 128, "nvram": 256,
"path": image_path, "path": image_path,
"private_config": "", "private_config": "",
"ram": 256, "ram": 1024,
"serial_adapters": 2, "serial_adapters": 2,
"startup_config": "iou_l3_base_startup-config.txt", "startup_config": "iou_l3_base_startup-config.txt",
"symbol": unittest.mock.ANY, "symbol": unittest.mock.ANY,
"use_default_iou_values": True, "use_default_iou_values": False,
"l1_keepalives": False} "l1_keepalives": False}
for item, value in expected_response.items(): for item, value in expected_response.items():