1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-12 19:38:57 +00:00

Fix tests after merge

This commit is contained in:
grossmj 2023-01-05 12:57:00 +08:00
parent 27d9063e56
commit 72e3d8f0c1
5 changed files with 7 additions and 5 deletions

View File

@ -288,9 +288,9 @@ class Controller:
except OSError as e:
log.error(f"Cannot read Etag appliance file '{etag_appliances_path}': {e}")
# FIXME
# FIXME install builtin appliances only once, need to store "version" somewhere...
#if parse_version(__version__) > parse_version(controller_settings.get("version", "")):
# self._appliance_manager.install_builtin_appliances()
# self._appliance_manager.install_builtin_appliances()
self._appliance_manager.install_builtin_appliances()
self._appliance_manager.load_appliances()

View File

@ -203,6 +203,7 @@ class QemuTemplate(Template):
kernel_command_line = Column(String)
replicate_network_connection_state = Column(Boolean)
create_config_disk = Column(Boolean)
tpm = Column(Boolean)
on_close = Column(String)
cpu_throttling = Column(Integer)
process_priority = Column(String)

View File

@ -205,6 +205,7 @@ class QemuBase(BaseModel):
create_config_disk: Optional[bool] = Field(
None, description="Automatically create a config disk on HDD disk interface (secondary slave)"
)
tpm: Optional[bool] = Field(None, description="Enable Trusted Platform Module (TPM)")
on_close: Optional[QemuOnCloseAction] = Field(None, description="Action to execute on the VM is closed")
cpu_throttling: Optional[int] = Field(None, ge=0, le=800, description="Percentage of CPU allowed for QEMU")
process_priority: Optional[QemuProcessPriority] = Field(None, description="Process priority for QEMU")

View File

@ -80,6 +80,7 @@ class QemuTemplate(TemplateBase):
create_config_disk: Optional[bool] = Field(
False, description="Automatically create a config disk on HDD disk interface (secondary slave)"
)
tpm: Optional[bool] = Field(False, description="Enable Trusted Platform Module (TPM)")
on_close: Optional[QemuOnCloseAction] = Field("power_off", description="Action to execute on the VM is closed")
cpu_throttling: Optional[int] = Field(0, ge=0, le=800, description="Percentage of CPU allowed for QEMU")
process_priority: Optional[QemuProcessPriority] = Field("normal", description="Process priority for QEMU")

View File

@ -379,10 +379,9 @@ def test_appliances(controller, config, tmpdir):
with open(str(tmpdir / "my_appliance2.gns3a"), 'w+') as f:
json.dump(my_appliance, f)
#config.settings.Server.appliances_path = str(tmpdir)
config.settings.Server.appliances_path = str(tmpdir)
controller.appliance_manager.install_builtin_appliances()
with patch("gns3server.config.Config.get_section_config", return_value={"appliances_path": str(tmpdir)}):
controller.appliance_manager.load_appliances()
controller.appliance_manager.load_appliances()
assert len(controller.appliance_manager.appliances) > 0
for appliance in controller.appliance_manager.appliances.values():
assert appliance.asdict()["status"] != "broken"