integration

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeSandboxController

type FakeSandboxController struct {
	Log    *slog.Logger
	EAC    *entityserver_v1alpha.EntityAccessClient
	NodeId string
}

FakeSandboxController replicates the disk management logic from controllers/sandbox/volume.go without requiring containerd or real networking. It creates/acquires disks and leases through the entity store, then relies on the harness's ReconcileAll to drive the disk controllers to completion.

func NewFakeSandboxController

func NewFakeSandboxController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, nodeId string) *FakeSandboxController

NewFakeSandboxController creates a new fake sandbox controller.

func (*FakeSandboxController) AcquireDiskLease

func (f *FakeSandboxController) AcquireDiskLease(ctx context.Context, diskID, sandboxID, appID entity.Id, mountPath string, readOnly bool) (entity.Id, error)

AcquireDiskLease creates a new DiskLease entity for the given sandbox. Mirrors controllers/sandbox/volume.go:acquireDiskLease.

func (*FakeSandboxController) EnsureDisk

func (f *FakeSandboxController) EnsureDisk(ctx context.Context, diskName string, sizeGB int64, filesystem string) (entity.Id, error)

EnsureDisk looks up or creates a Disk entity by name. Mirrors controllers/sandbox/volume.go:ensureDisk.

func (*FakeSandboxController) ReleaseDiskLeases

func (f *FakeSandboxController) ReleaseDiskLeases(ctx context.Context, sandboxID entity.Id) error

ReleaseDiskLeases releases all disk leases owned by the given sandbox. Mirrors controllers/sandbox/sandbox.go:releaseDiskLeases.

type TestHarness

type TestHarness struct {
	T      *testing.T
	Server *testutils.InMemEntityServer
	Log    *slog.Logger
	EAC    *entityserver_v1alpha.EntityAccessClient

	// Runner-side controllers
	DiskCtrl      *disk.DiskController
	DiskLeaseCtrl *disk.DiskLeaseController

	// Disk I/O controllers (with mock ops)
	DiskVolumeCtrl *diskio.DiskVolumeController
	DiskMountCtrl  *diskio.DiskMountController
	DiskioState    *diskio.State

	// Fake sandbox
	FakeSandbox *FakeSandboxController

	// ReconcileControllers (for ProcessEventForTest)
	DiskRC      *controller.ReconcileController
	DiskLeaseRC *controller.ReconcileController
	DiskVolRC   *controller.ReconcileController
	DiskMntRC   *controller.ReconcileController

	// Mock ops for test inspection
	MockVolumeOps *mockDiskVolumeOps
	MockMountOps  *mockDiskMountOps

	// DataPath is the temp directory used for disk data (volumes, segments, etc.)
	DataPath string
}

TestHarness wires all disk-lifecycle controllers together with a shared in-memory entity server for integration testing.

func NewTestHarness

func NewTestHarness(t *testing.T) *TestHarness

NewTestHarness creates a fully wired test harness for disk lifecycle integration tests.

func (*TestHarness) ReconcileAll

func (h *TestHarness) ReconcileAll(ctx context.Context, maxIterations int)

ReconcileAll reconciles all disk-related entities across all controllers until the system converges (no entity revisions change) or maxIterations is reached.

func (*TestHarness) ReconcileEntity

func (h *TestHarness) ReconcileEntity(ctx context.Context, id entity.Id) error

ReconcileEntity fetches an entity by ID and processes it through the appropriate controller.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL