Documentation
¶
Overview ¶
ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE
Package testutil holds test fixtures shared by the internal packages' tests. It is imported only from _test.go files.
ENGMODEL-OWNER-UNIT: FU-SYSTEM-COMPOSITION
ENGMODEL-OWNER-UNIT: FU-MODEL-LOADER
Index ¶
- func AssertDiag(t testing.TB, diags []validate.Diagnostic, code, fragment string)
- func ChdirRepoRoot() error
- func SchemaV2Bundle(bundle model.Bundle) model.Bundle
- func WriteFile(t testing.TB, path, content string)
- func WriteInterfaceModule(t testing.TB, dir string)
- func WriteOCIModuleFixture(t testing.TB, dir, modulePath, modelID, capabilityID, requirementID string)
- func WriteParentWithOCIModule(t testing.TB, dir, modulePath, version string)
- func WriteV2CompositionModule(t testing.TB, dir, modulePath, version, modelID, publication string, ...)
- func WriteV2CompositionParent(t testing.TB, dir, dependencies, architecture string)
- func WriteV2ModuleFiles(t testing.TB, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertDiag ¶
func AssertDiag(t testing.TB, diags []validate.Diagnostic, code, fragment string)
AssertDiag fails the test unless diags holds a diagnostic with the code whose message or path mentions fragment. TRLC-LINKS: REQ-EMG-059
func ChdirRepoRoot ¶
func ChdirRepoRoot() error
ChdirRepoRoot changes the working directory to the repository root (the directory holding go.mod above the current one), so package tests use the repository-relative paths (examples/..., engmod.yml, model/..., go run ./cmd/...) they used when the implementation lived in the root package. TRLC-LINKS: REQ-EMG-001
func SchemaV2Bundle ¶
SchemaV2Bundle stamps the current schema version on every document of a hand-built test bundle that does not set one. TRLC-LINKS: REQ-EMG-046
func WriteFile ¶
WriteFile writes content to path, creating its parent directories. TRLC-LINKS: REQ-EMG-047, REQ-EMG-048, REQ-EMG-049, REQ-EMG-051
func WriteInterfaceModule ¶
WriteInterfaceModule writes the example.com/iface@v0 module: it publishes an FG, FU, IF, DO, actor, trust boundary, control and the capability CAP-SCHEMA. TRLC-LINKS: REQ-EMG-065
func WriteOCIModuleFixture ¶
func WriteOCIModuleFixture(t testing.TB, dir, modulePath, modelID, capabilityID, requirementID string)
WriteOCIModuleFixture writes a publishable module providing capabilityID (ref requirementID) under the publication "public". TRLC-LINKS: REQ-EMG-047, REQ-EMG-048
func WriteParentWithOCIModule ¶
WriteParentWithOCIModule writes a parent depending on modulePath@version as alias "shared", composing it as SUB-SHARED and delegating REQ-PARENT to shared::CAP-SHARED-EDGE. TRLC-LINKS: REQ-EMG-047, REQ-EMG-048
func WriteV2CompositionModule ¶
func WriteV2CompositionModule(t testing.TB, dir, modulePath, version, modelID, publication string, architectureIDs, requirementIDs []string)
WriteV2CompositionModule writes a v2 module that provides one capability (the first architecture ID) and publishes the given IDs as publication. TRLC-LINKS: REQ-EMG-047, REQ-EMG-048, REQ-EMG-049, REQ-EMG-051
func WriteV2CompositionParent ¶
WriteV2CompositionParent writes the example.com/parent@v1 module with the given dependencies block and architecture body. TRLC-LINKS: REQ-EMG-047, REQ-EMG-048, REQ-EMG-049, REQ-EMG-051
func WriteV2ModuleFiles ¶
func WriteV2ModuleFiles(t testing.TB, dir, modulePath, version, modelID, manifestExtra, architecture string)
WriteV2ModuleFiles writes a schema-v2 model module (cue.mod, engmod.yml and the eight domain documents) to dir; manifestExtra is inserted before the documents block and architecture is the body of architecture.yml. TRLC-LINKS: REQ-EMG-047, REQ-EMG-048, REQ-EMG-049, REQ-EMG-051
Types ¶
This section is empty.