drivertest

package
v0.0.1-dev.137 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package drivertest provides a conformance test harness for storage Driver implementations. Built-in drivers and out-of-tree drivers alike run RunConformance(t, factory) to verify they implement the contract from pkg/storage/driver consistently.

The harness exercises the full lifecycle a driver is expected to support — provision -> attach -> mount -> write -> unmount -> detach -> snapshot -> restore -> expand -> delete — gating capability-specific stages on the driver's advertised Capabilities.

Introduced in RUNE-069.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunConformance

func RunConformance(t *testing.T, cfg Config)

RunConformance runs the full conformance suite against cfg.Driver. It is intended to be called from a *_test.go file via t.Run("conformance", ...).

Types

type Config

type Config struct {
	// Driver is the instance under test. Must already be configured.
	Driver driver.Driver

	// NewVolume returns a fresh Volume + StorageClass + parameters for each
	// test case. The harness calls it multiple times. Implementations are
	// responsible for picking unique names and (for local-host style
	// drivers) writable host paths.
	NewVolume func(t *testing.T) (*types.Volume, *types.StorageClass, map[string]string)

	// NodeID is the synthetic node identifier passed to Attach/Mount.
	// Defaults to "node-test" when empty.
	NodeID driver.NodeID

	// MountTargetRoot is the directory the harness creates per-volume mount
	// targets under. Defaults to t.TempDir() when empty.
	MountTargetRoot string

	// SkipExpand skips the expand stage even if Capabilities.Expand is true
	// (useful for drivers whose backing infra can't easily resize in CI).
	SkipExpand bool

	// SkipSnapshot skips the snapshot stage even if Capabilities.Snapshots
	// is true.
	SkipSnapshot bool
}

Config controls how the conformance suite exercises a driver.

Jump to

Keyboard shortcuts

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