Documentation
¶
Overview ¶
Package bench runs reference-server test scenarios in simulated and live workspaces.
A workspace keeps local identities and configuration across runs. Start can embed the server runtime or launch dmserver processes, using the same server configuration in either case. Up supervises those processes in the foreground; other commands attach through an authenticated loopback control endpoint.
Simulated workspaces provide local service fixtures. Live scenarios require the operator's credentials and device enrollment. Doctor reports missing prerequisites without enrolling a device or changing its trust settings.
See the reference bench guide: https://github.com/deploymenttheory/go-apple-dm/blob/main/docs/operations/reference-bench.md
Index ¶
- Variables
- func EnrollmentPreflight(w *Workspace, identity string) map[string]any
- func ExportTrust(w *Workspace, destination string) error
- func HTTP(ctx context.Context, c *http.Client, base, token, method, path string, ...) ([]byte, int, error)
- func Init(dir, mode, storage, topology, listen string) error
- func Markdown() string
- func Profile(ctx context.Context, e *Environment, device, destination string) error
- func ProfileWithIdentity(ctx context.Context, e *Environment, device, identity, destination string) error
- func Replace(ctx context.Context, e *Environment, device, identity string) (map[string]any, error)
- func Up(ctx context.Context, w *Workspace, binary string, out io.Writer) error
- func WriteReports(dir string, results []Result) error
- type Environment
- type Instance
- type Result
- type Scenario
- type Workspace
Constants ¶
This section is empty.
Variables ¶
var ErrBlocked = errors.New("scenario prerequisites unavailable")
Functions ¶
func EnrollmentPreflight ¶
EnrollmentPreflight checks local prerequisites without installing profiles or changing trust. Service discovery and device delivery have separate scenarios.
func ExportTrust ¶
ExportTrust bootstraps private HTTPS trust before the Mac can fetch an HTTPS profile.
func HTTP ¶
func HTTP( ctx context.Context, c *http.Client, base, token, method, path string, body io.Reader, ) ([]byte, int, error)
HTTP performs a bounded admin request. Errors contain status, never bodies or tokens.
func Profile ¶
func Profile(ctx context.Context, e *Environment, device, destination string) error
Profile requests the actual configured enrollment service and writes a new file.
func ProfileWithIdentity ¶
func ProfileWithIdentity( ctx context.Context, e *Environment, device, identity, destination string, ) error
ProfileWithIdentity exports the configured profile with the rights needed for inventory and controlled profile replacement. Empty identity uses server defaults.
func Up ¶
Up supervises processes in the foreground. A separate dmctl bench down uses the authenticated loopback control endpoint, never a possibly recycled PID.
func WriteReports ¶
WriteReports writes private JSON evidence and a JUnit projection. Non-passes never become successes merely because the selected execution mode lacks a device.
Types ¶
type Environment ¶
type Environment struct {
// InstallingUserID is the local user's GeneratedUID, supplied by the operator
// for live enrollment acceptance. It is not inferred from an arbitrary child.
InstallingUserID string
DEP *deptest.Server
ABM *axmtest.Server
Provider *webauthtest.Provider
Authority *testpki.CA
Instance
Client *http.Client
Token string
APNS *pushtest.Server
Workspace *Workspace
// contains filtered or unexported fields
}
Environment owns fixture services and the ordinary server runtime(s).
func Attach ¶
func Attach(w *Workspace) (*Environment, error)
func AttachURL ¶
func AttachURL(w *Workspace, address string) (*Environment, error)
AttachURL connects to an existing live server using the workspace's trust and admin credential. It does not start a supervisor, replace state or migrate SQL.
func Start ¶
Start uses the same configuration and runtime in both adapters. A nonempty binary launches dmserver; an empty binary embeds runtime.Serve for E2E tests.
func (*Environment) Close ¶
func (e *Environment) Close()
Close stops all runtimes before releasing fixture services.
type Instance ¶
type Instance struct {
Binary string `json:"Binary"`
URL string `json:"URL"`
DDMURL string `json:"DDMURL"`
ControlURL string `json:"ControlURL"`
ControlToken string `json:"ControlToken"`
Mode string `json:"Mode"`
Topology string `json:"Topology"`
}
Instance describes the running workspace. The control credential stays private.
type Result ¶
type Result struct {
ID string `json:"ID"`
Name string `json:"Name"`
Mode string `json:"Mode"`
Adapter string `json:"Adapter"`
Revision string `json:"Revision"`
Status string `json:"Status"`
Detail string `json:"Detail"`
Started time.Time `json:"Started"`
Duration time.Duration `json:"Duration"`
}
Result distinguishes unavailable prerequisites from an assertion failure.
type Scenario ¶
type Scenario struct {
Settings map[string]string `json:"Settings,omitempty"`
Topology string `json:"Topology,omitempty"`
ID string `json:"ID"`
Name string `json:"Name"`
Family string `json:"Family"`
Regression string `json:"Regression"`
Modes []string `json:"Modes"`
Prerequisites []string `json:"Prerequisites"`
Run func(context.Context, *Environment, string) error `json:"-"`
}
Scenario is the maintained inventory; implementations never depend on testing.T. Regression names retain the original detailed assertions during migration.
func Catalogue ¶
func Catalogue() []Scenario
Catalogue returns a fresh inventory in stable ID order.
func SelectMode ¶
SelectMode makes all select the applicable scenarios; explicit IDs still report unsupported modes rather than being silently ignored.
type Workspace ¶
type Workspace struct {
Settings map[string]string `json:"Settings,omitempty"`
Version int `json:"Version"`
Mode string `json:"Mode"`
Storage string `json:"Storage"`
Topology string `json:"Topology"`
Listen string `json:"Listen"`
DSN string `json:"DSN,omitempty"`
Directory string `json:"-"`
}
Workspace contains non-secret settings. Existing local identities stay in mdm/.