generated from coulomb/repo-seed
Add workspace checkpoint API with SnapshotStore, extension hooks on compose-ssh and saas-stub, manager orchestration, CLI/HTTP surface, profile.compose-checkpoint, and docs/tests.
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""Extension SDK base class tests."""
|
|
|
|
import pytest
|
|
|
|
from sandboxer.extensions.base import SandboxExtension
|
|
from sandboxer.extensions.compose_ssh import ComposeSSHExtension
|
|
from sandboxer.extensions.vm_packer import VMPackerExtension
|
|
|
|
|
|
def test_reference_extensions_subclass_base() -> None:
|
|
assert issubclass(ComposeSSHExtension, SandboxExtension)
|
|
assert issubclass(VMPackerExtension, SandboxExtension)
|
|
|
|
|
|
def test_new_sandbox_id_from_inputs() -> None:
|
|
assert SandboxExtension.new_sandbox_id({"sandbox_id": "fixed123"}) == "fixed123"
|
|
generated = SandboxExtension.new_sandbox_id({})
|
|
assert len(generated) == 8
|
|
|
|
|
|
def test_default_snapshot_not_supported() -> None:
|
|
class MinimalExtension(SandboxExtension):
|
|
def provision(self, profile, inputs, host):
|
|
return {}
|
|
|
|
def wait_ready(self, handle):
|
|
return {}
|
|
|
|
def teardown(self, handle):
|
|
return {}
|
|
|
|
ext = MinimalExtension()
|
|
assert ext.supports_snapshots() is False
|
|
with pytest.raises(NotImplementedError):
|
|
ext.snapshot({}) |