Documentation ¶
Index ¶
- Variables
- func AddTag[T ~string](r *ResourceSpec, tag T)
- func ColorFor(s string) *color.Color
- func Colored[T ~string](t T) string
- func GenerateReproTest(t lt.TB, sso StackSpecOptions, snapSpec *SnapshotSpec, progSpec *ProgramSpec, ...) string
- func GeneratedFixture(fo FixtureOptions) func(t *rapid.T)
- func GeneratedPlanSpec(ss *SnapshotSpec, pso PlanSpecOptions) *rapid.Generator[*PlanSpec]
- func GeneratedProgramSpec(ss *SnapshotSpec, sso StackSpecOptions, pso ProgramSpecOptions) *rapid.Generator[*ProgramSpec]
- func GeneratedProviderResourceSpec(sso StackSpecOptions) *rapid.Generator[*ResourceSpec]
- func GeneratedProviderSpec(progSpec *ProgramSpec, pso ProviderSpecOptions) *rapid.Generator[*ProviderSpec]
- func GeneratedResourceDependencies(ss *SnapshotSpec, r *ResourceSpec, include func(*ResourceSpec) bool) *rapid.Generator[*ResourceDependenciesSpec]
- func GeneratedResourceSpec(sso StackSpecOptions, rso ResourceSpecOptions, ...) *rapid.Generator[*ResourceSpec]
- func GeneratedResourceType(pkg tokens.Package) *rapid.Generator[tokens.Type]
- func GeneratedSnapshotSpec(sso StackSpecOptions, snso SnapshotSpecOptions) *rapid.Generator[*SnapshotSpec]
- type FixtureOptions
- type OperationSpec
- type PlanSpec
- type PlanSpecOptions
- type PrettySpec
- type ProgramResourceTag
- type ProgramSpec
- type ProgramSpecAction
- type ProgramSpecOptions
- type ProviderCreateSpec
- type ProviderCreateSpecAction
- type ProviderDeleteSpec
- type ProviderDeleteSpecAction
- type ProviderDiffSpec
- type ProviderDiffSpecAction
- type ProviderReadSpec
- type ProviderReadSpecAction
- type ProviderSpec
- type ProviderSpecOptions
- type ProviderUpdateSpec
- type ProviderUpdateSpecAction
- type ResourceDependenciesSpec
- type ResourceSpec
- type ResourceSpecOptions
- type SnapshotSpec
- type SnapshotSpecAction
- type SnapshotSpecOptions
- type StackSpecOptions
Constants ¶
This section is empty.
Variables ¶
var GeneratedProviderType = rapid.Custom(func(t *rapid.T) tokens.Type { pkg := rapid.StringMatching("^pkg-[a-z][A-Za-z0-9]{3}$").Draw(t, "ProviderType.Package") return tokens.Type("codeinfra:providers:" + pkg) })
A rapid.Generator that yields random provider types.
GeneratedProviderType.Draw(t, "ProviderType") = "codeinfra:providers:<pkg>"
var GeneratedResourceID = rapid.Custom(func(t *rapid.T) resource.ID { id := rapid.StringMatching("^id-[a-z][A-Za-z0-9]{11}$").Draw(t, "ResourceID") return resource.ID(id) })
A rapid.Generator that yields random resource IDs.
GeneratedResourceID.Draw(t, "ResourceID") = "id-<random>"
var GeneratedResourceName = rapid.Custom(func(t *rapid.T) string { name := rapid.StringMatching("^res-[a-z][A-Za-z0-9]{3}$").Draw(t, "ResourceName") return name })
A rapid.Generator that yields random resource names.
GeneratedResourceName.Draw(t, "ResourceName") = "res-<random>"
Functions ¶
func AddTag ¶
func AddTag[T ~string](r *ResourceSpec, tag T)
AddTag adds the given tag to the given ResourceSpec. Ideally this would be a generic method on ResourceSpec itself, but Go doesn't support generic methods yet.
func ColorFor ¶
ColorFor accepts a string and hashes it to produce an RGB color. This is useful for making e.g. different URNs easy to identify by giving them unique colors when pretty-printing them.
func GenerateReproTest ¶
func GenerateReproTest( t lt.TB, sso StackSpecOptions, snapSpec *SnapshotSpec, progSpec *ProgramSpec, provSpec *ProviderSpec, planSpec *PlanSpec, ) string
GenerateReproTest generates a string containing Go code for a set of lifecycle tests that reproduce the scenario captured by the given *Specs.
func GeneratedFixture ¶
func GeneratedFixture(fo FixtureOptions) func(t *rapid.T)
Given a set of options, returns a Rapid property test function that generates and tests fixtures according to that configuration.
func GeneratedPlanSpec ¶
func GeneratedPlanSpec(ss *SnapshotSpec, pso PlanSpecOptions) *rapid.Generator[*PlanSpec]
Given a SnapshotSpec and a set of options, returns a rapid.Generator that will produce PlanSpecs that can be executed against the specified snapshot.
func GeneratedProgramSpec ¶
func GeneratedProgramSpec( ss *SnapshotSpec, sso StackSpecOptions, pso ProgramSpecOptions, ) *rapid.Generator[*ProgramSpec]
Given a SnapshotSpec and a set of options, returns a rapid.Generator that will produce ProgramSpecs that operate upon the specified snapshot.
func GeneratedProviderResourceSpec ¶
func GeneratedProviderResourceSpec( sso StackSpecOptions, ) *rapid.Generator[*ResourceSpec]
Given a set of StackSpecOptions, returns a rapid.Generator that yields random provider ResourceSpecs with no dependencies. Provider resources are always custom and never deleted.
func GeneratedProviderSpec ¶
func GeneratedProviderSpec(progSpec *ProgramSpec, pso ProviderSpecOptions) *rapid.Generator[*ProviderSpec]
Given a ProgramSpec and a set of ProviderSpecOptions, returns a rapid.Generator that will produce random ProviderSpecs that affect the resources defined in the ProgramSpec.
func GeneratedResourceDependencies ¶
func GeneratedResourceDependencies( ss *SnapshotSpec, r *ResourceSpec, include func(*ResourceSpec) bool, ) *rapid.Generator[*ResourceDependenciesSpec]
Given a SnapshotSpec and ResourceSpec, returns a rapid.Generator that yields random (valid) sets of dependencies for the given resource on resources in the given snapshot.
func GeneratedResourceSpec ¶
func GeneratedResourceSpec( sso StackSpecOptions, rso ResourceSpecOptions, provs map[tokens.Package]*ResourceSpec, ) *rapid.Generator[*ResourceSpec]
Given a set of StackSpecOptions, ResourceSpecOptions, and a map of package names to provider resources, returns a rapid.Generator that yields random ResourceSpecs with no dependencies.
func GeneratedResourceType ¶
Given a package name, returns a rapid.Generator that yields random resource types within that package.
GeneratedResourceType("pkg-xyz").Draw(t, "ResourceType") = "pkg-xyz:<mod>:<type>"
func GeneratedSnapshotSpec ¶
func GeneratedSnapshotSpec(sso StackSpecOptions, snso SnapshotSpecOptions) *rapid.Generator[*SnapshotSpec]
Given a set of StackSpecOptions and SnapshotSpecOptions, returns a rapid.Generator that yields random SnapshotSpecs.
Types ¶
type FixtureOptions ¶
type FixtureOptions struct { StackSpecOptions StackSpecOptions SnapshotSpecOptions SnapshotSpecOptions ProgramSpecOptions ProgramSpecOptions ProviderSpecOptions ProviderSpecOptions PlanSpecOptions PlanSpecOptions }
A set of options for configuring the generation of a fuzzing lifecycle test fixture. A fixture comprises a stack, an initial snapshot, a program to execute against that snapshot, a set of providers to use when executing the program, and a plan to execute and observe the results of.
func (FixtureOptions) With ¶
func (fo FixtureOptions) With(overrides FixtureOptions) FixtureOptions
Returns a copy of the FixtureOptions with the given overrides applied.
type OperationSpec ¶
type OperationSpec string
The type of operations that may be executed as part of a PlanSpec.
const ( // An update operation. PlanOperationUpdate OperationSpec = "plan.update" // A refresh operation. PlanOperationRefresh OperationSpec = "plan.refresh" // A destroy operation. PlanOperationDestroy OperationSpec = "plan.destroy" )
type PlanSpec ¶
type PlanSpec struct { // The operation that will be executed (e.g. update, refresh, destroy). Operation OperationSpec // The set of target URNs that will be passed to the operation, if any. TargetURNs []resource.URN }
A PlanSpec specifies a lifecycle test operation that executes some program against an initial snapshot using a configured set of providers.
func (*PlanSpec) Executors ¶
func (ps *PlanSpec) Executors(t lt.TB, hostF deploytest.PluginHostFactory) (lt.TestUpdateOptions, lt.TestOp)
Returns a set of test options and a test operation that can be used to execute this PlanSpec as part of a lifecycle test.
type PlanSpecOptions ¶
type PlanSpecOptions struct { // A generator for operations that might be planned. Operation *rapid.Generator[OperationSpec] // A source set of targets that should be used literally, skipping the target generation process. SourceTargets []resource.URN // A generator for the maximum number of resources to target in a plan. TargetCount *rapid.Generator[int] }
A set of options for configuring the generation of a PlanSpec.
func (PlanSpecOptions) With ¶
func (pso PlanSpecOptions) With(overrides PlanSpecOptions) PlanSpecOptions
Returns a copy of the given PlanSpecOptions with the given overrides applied.
type PrettySpec ¶
type PrettySpec interface { // Returns a pretty human-readable string representation of this spec. Pretty(indent string) string }
PrettySpecs can be pretty-printed as human-readable strings for use in debugging output and error messages.
type ProgramResourceTag ¶
type ProgramResourceTag string
The type of tags that may be added to resources in a ProgramSpec.
const ( // Tags a resource as having been newly prepended to the program. NewlyPrependedProgramResource ProgramResourceTag = "program.newly-prepended" // Tags a resource as having been dropped from the program. DroppedProgramResource ProgramResourceTag = "program.dropped" // Tags a resource as having been newly inserted into the program (that is, between two resources that already exist // in the snapshot the program will execute against). NewlyInsertedProgramResource ProgramResourceTag = "program.newly-inserted" // Tags a resource as having been updated in the program (that is, provided a new set of inputs to those held in the // snapshot that the program will execute against). UpdatedProgramResource ProgramResourceTag = "program.updated" // Tags a resource as having been copied from the snapshot the program will execute against. CopiedProgramResource ProgramResourceTag = "program.copied" // Tags a resource as having been newly appended to the program. NewlyAppendedProgramResource ProgramResourceTag = "program.newly-appended" )
type ProgramSpec ¶
type ProgramSpec struct { // The set of resource registrations made by the program. ResourceRegistrations []*ResourceSpec // The set of resources present in the snapshot the program will execute against that will *not* be registered (that // is, they will be "dropped"). Drops []*ResourceSpec }
A ProgramSpec specifies a Codeinfra program whose execution will be mocked in a lifecycle test in order to register resources.
func (*ProgramSpec) AsLanguageRuntimeF ¶
func (ps *ProgramSpec) AsLanguageRuntimeF(t require.TestingT) deploytest.LanguageRuntimeFactory
Returns a new LanguageRuntimeFactory that will register the resources specified in this ProgramSpec when executed.
func (*ProgramSpec) Pretty ¶
func (ps *ProgramSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable representation of this ProgramSpec, suitable for use in debugging output and error messages.
type ProgramSpecAction ¶
type ProgramSpecAction string
The set of actions that may be taken on resources in a ProgramSpec.
const ( // Deletes a resource from the program. ProgramSpecDelete ProgramSpecAction = "delete" // Inserts a new resource into the program. ProgramSpecInsert ProgramSpecAction = "insert" // Updates a resource in the program. ProgramSpecUpdate ProgramSpecAction = "update" // Copies a resource from the snapshot the program will execute against. ProgramSpecCopy ProgramSpecAction = "copy" )
type ProgramSpecOptions ¶
type ProgramSpecOptions struct { PrependCount *rapid.Generator[int] PrependResourceOpts ResourceSpecOptions Action *rapid.Generator[ProgramSpecAction] InsertResourceOpts ResourceSpecOptions UpdateProtect *rapid.Generator[bool] UpdateRetainOnDelete *rapid.Generator[bool] AddAliases *rapid.Generator[bool] AppendCount *rapid.Generator[int] AppendResourceOpts ResourceSpecOptions }
A set of options for configuring the generation of a ProgramSpec.
func (ProgramSpecOptions) With ¶
func (pso ProgramSpecOptions) With(overrides ProgramSpecOptions) ProgramSpecOptions
Returns a copy of the given ProgramSpecOptions with the given overrides applied.
type ProviderCreateSpec ¶
type ProviderCreateSpec map[resource.URN]ProviderCreateSpecAction
A ProviderCreateSpec specifies the behavior of a provider's create function. It maps resource URNs to the action that should be taken if Create is called on that URN. The absence of a URN in the map indicates that the default behavior (a successful create) should be taken.
func (ProviderCreateSpec) AsCreateF ¶
func (pcs ProviderCreateSpec) AsCreateF() func(context.Context, plugin.CreateRequest) (plugin.CreateResponse, error)
Returns a CreateF-compatible callback that implements this ProviderCreateSpec.
func (ProviderCreateSpec) Pretty ¶
func (pcs ProviderCreateSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable string representation of this ProviderCreateSpec, suitable for use in debugging output or error messages.
type ProviderCreateSpecAction ¶
type ProviderCreateSpecAction string
ProviderCreateSpecAction captures the set of actions that can be taken by a Create implementation for a given resource.
const ( // Fail the Create operation. ProviderCreateFailure ProviderCreateSpecAction = "provider.create-failure" )
type ProviderDeleteSpec ¶
type ProviderDeleteSpec map[resource.URN]ProviderDeleteSpecAction
A ProviderDeleteSpec specifies the behavior of a provider's delete function. It maps resource URNs to the action that should be taken if Delete is called on that URN. The absence of a URN in the map indicates that the default behavior (a successful delete) should be taken.
func (ProviderDeleteSpec) AsDeleteF ¶
func (pds ProviderDeleteSpec) AsDeleteF() func(context.Context, plugin.DeleteRequest) (plugin.DeleteResponse, error)
Returns a DeleteF-compatible callback that implements this ProviderDeleteSpec.
func (ProviderDeleteSpec) Pretty ¶
func (pds ProviderDeleteSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable string representation of this ProviderDeleteSpec, suitable for use in debugging output or error messages.
type ProviderDeleteSpecAction ¶
type ProviderDeleteSpecAction string
ProviderDeleteSpecAction captures the set of actions that can be taken by a Delete implementation for a given resource.
const ( // Fail the Delete operation. ProviderDeleteFailure ProviderDeleteSpecAction = "provider.delete-failure" )
type ProviderDiffSpec ¶
type ProviderDiffSpec map[resource.URN]ProviderDiffSpecAction
A ProviderDiffSpec specifies the behavior of a provider's diff function. It maps resource URNs to the action that should be taken if Diff is called on that URN. The absence of a URN in the map indicates that the default behavior (a successful diff that reports no changes) should be taken.
func (ProviderDiffSpec) AsDiffF ¶
func (pds ProviderDiffSpec) AsDiffF() func(context.Context, plugin.DiffRequest) (plugin.DiffResponse, error)
Returns a DiffF-compatible callback that implements this ProviderDiffSpec.
func (ProviderDiffSpec) Pretty ¶
func (pds ProviderDiffSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable string representation of this ProviderDiffSpec, suitable for use in debugging output or error messages.
type ProviderDiffSpecAction ¶
type ProviderDiffSpecAction string
ProviderDiffSpecAction captures the set of actions that can be taken by a Diff implementation for a given resource.
const ( // Return a diff that indicates that the resource should be deleted before being replaced. ProviderDiffDeleteBeforeReplace ProviderDiffSpecAction = "provider.diff-delete-before-replace" // Return a diff that indicates that the resource should be replaced by first creating a replacement. ProviderDiffDeleteAfterReplace ProviderDiffSpecAction = "provider.diff-delete-after-replace" // Return a diff that indicates that the resource should be updated in place. ProviderDiffChange ProviderDiffSpecAction = "provider.diff-change" // Fail the Diff operation. ProviderDiffFailure ProviderDiffSpecAction = "provider.diff-failure" )
type ProviderReadSpec ¶
type ProviderReadSpec map[resource.URN]ProviderReadSpecAction
A ProviderReadSpec specifies the behavior of a provider's read function. It maps resource URNs to the action that should be taken if Read is called on that URN. The absence of a URN in the map indicates that the default behavior (a successful read that reports that the resource exists) should be taken.
func (ProviderReadSpec) AsReadF ¶
func (prs ProviderReadSpec) AsReadF() func(context.Context, plugin.ReadRequest) (plugin.ReadResponse, error)
Returns a ReadF-compatible callback that implements this ProviderReadSpec.
func (ProviderReadSpec) Pretty ¶
func (prs ProviderReadSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable string representation of this ProviderReadSpec, suitable for use in debugging output or error messages.
type ProviderReadSpecAction ¶
type ProviderReadSpecAction string
ProviderReadSpecAction captures the set of actions that can be taken by a Read implementation for a given resource.
const ( // Return a result that indicates that the resource has been deleted. ProviderReadDeleted ProviderReadSpecAction = "provider.read-deleted" // Fail the Read operation. ProviderReadFailure ProviderReadSpecAction = "provider.read-failure" )
type ProviderSpec ¶
type ProviderSpec struct { Packages map[tokens.Package]bool Create ProviderCreateSpec Delete ProviderDeleteSpec Diff ProviderDiffSpec Read ProviderReadSpec Update ProviderUpdateSpec }
A ProviderSpec specifies the behavior of a set of providers that will be mocked in a lifecycle test.
func (*ProviderSpec) AddPackage ¶
func (ps *ProviderSpec) AddPackage(pkg tokens.Package)
Adds the given package to the set of packages that this ProviderSpec will mock.
func (*ProviderSpec) AsProviderLoaders ¶
func (ps *ProviderSpec) AsProviderLoaders() []*deploytest.ProviderLoader
Returns a deploytest.ProviderLoader representation of this ProviderSpec, suitable for use in a lifecycle test.
func (*ProviderSpec) Pretty ¶
func (ps *ProviderSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable representation of this ProviderSpec, suitable for use in debugging output and error messages.
type ProviderSpecOptions ¶
type ProviderSpecOptions struct { CreateAction *rapid.Generator[ProviderCreateSpecAction] DeleteAction *rapid.Generator[ProviderDeleteSpecAction] DiffAction *rapid.Generator[ProviderDiffSpecAction] ReadAction *rapid.Generator[ProviderReadSpecAction] UpdateAction *rapid.Generator[ProviderUpdateSpecAction] }
A set of options for configuring the generation of a ProviderSpec.
func (ProviderSpecOptions) With ¶
func (pso ProviderSpecOptions) With(overrides ProviderSpecOptions) ProviderSpecOptions
Returns a copy of the given ProviderSpecOptions with the given overrides applied.
type ProviderUpdateSpec ¶
type ProviderUpdateSpec map[resource.URN]ProviderUpdateSpecAction
A ProviderUpdateSpec specifies the behavior of a provider's update function. It maps resource URNs to the action that should be taken if Update is called on that URN. The absence of a URN in the map indicates that the default behavior (a successful update) should be taken.
func (ProviderUpdateSpec) AsUpdateF ¶
func (pus ProviderUpdateSpec) AsUpdateF() func(context.Context, plugin.UpdateRequest) (plugin.UpdateResponse, error)
Returns an UpdateF-compatible callback that implements this ProviderUpdateSpec.
func (ProviderUpdateSpec) Pretty ¶
func (pus ProviderUpdateSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable string representation of this ProviderUpdateSpec, suitable for use in debugging output and error messages.
type ProviderUpdateSpecAction ¶
type ProviderUpdateSpecAction string
ProviderUpdateSpecAction captures the set of actions that can be taken by an Update implementation for a given resource.
const ( // Fail the Update operation. ProviderUpdateFailure ProviderUpdateSpecAction = "provider.update-failure" )
type ResourceDependenciesSpec ¶
type ResourceDependenciesSpec struct { Parent resource.URN Dependencies []resource.URN PropertyDependencies map[resource.PropertyKey][]resource.URN DeletedWith resource.URN }
A ResourceDependenciesSpec specifies the dependencies of a resource in a snapshot.
func (*ResourceDependenciesSpec) ApplyTo ¶
func (rds *ResourceDependenciesSpec) ApplyTo(r *ResourceSpec)
ApplyTo applies the dependencies specified in this ResourceDependenciesSpec to the given ResourceSpec.
type ResourceSpec ¶
type ResourceSpec struct { Project tokens.PackageName Stack tokens.QName Type tokens.Type Name string ID resource.ID Custom bool Delete bool Protect bool PendingReplacement bool RetainOnDelete bool Provider string Parent resource.URN Dependencies []resource.URN PropertyDependencies map[resource.PropertyKey][]resource.URN DeletedWith resource.URN Aliases []resource.URN // A set of tags associated with the resource. These have no bearing on any tests but are included to aid in debugging // and identifying the causes of snapshot integrity issues. Tags map[string]bool }
A ResourceSpec specifies the subset of a resource's state that is relevant to fuzzing snapshot integrity issues. Generally this encompasses enough to identify a resource (URN, ID, and so on) and any dependencies it may have on others.
func FromResource ¶
func FromResource(r *resource.State) *ResourceSpec
Creates a ResourceSpec from the given resource.State.
func FromResourceV3 ¶
func FromResourceV3(r apitype.ResourceV3) *ResourceSpec
Creates a ResourceSpec from the given ResourceV3.
func (*ResourceSpec) AsResource ¶
func (r *ResourceSpec) AsResource() *resource.State
Returns a resource.State representation of this ResourceSpec, suitable for inclusion in e.g. a snapshot.
func (*ResourceSpec) Copy ¶
func (r *ResourceSpec) Copy() *ResourceSpec
Copy returns a deep copy of this ResourceSpec.
func (*ResourceSpec) Pretty ¶
func (r *ResourceSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable representation of this ResourceSpec, suitable for use in debugging output and error messages.
<urn> [provider, custom]
Tags: program.updated, snapshot.provider.initial Protect: false Pending replacement: false Retain on delete: false Dependencies (1): <urn>
func (*ResourceSpec) URN ¶
func (r *ResourceSpec) URN() resource.URN
URN returns the URN of this ResourceSpec.
type ResourceSpecOptions ¶
type ResourceSpecOptions struct { Custom *rapid.Generator[bool] Protect *rapid.Generator[bool] PendingReplacement *rapid.Generator[bool] RetainOnDelete *rapid.Generator[bool] }
A set of options for configuring the generation of a ResourceSpec.
func (ResourceSpecOptions) With ¶
func (rso ResourceSpecOptions) With(overrides ResourceSpecOptions) ResourceSpecOptions
Returns a copy of the given ResourceSpecOptions with the given overrides applied.
type SnapshotSpec ¶
type SnapshotSpec struct { // A mapping from package names to provider resources. The provider resources will also be included in the Resources // slice -- this field serves as a means to quickly look up provider resources by package name. Providers map[tokens.Package]*ResourceSpec // The set of resources in the snapshot. Resources []*ResourceSpec }
A SnapshotSpec specifies a snapshot containing a set of resources managed by a set of providers.
func FromDeploymentV3 ¶
func FromDeploymentV3(d *apitype.DeploymentV3) *SnapshotSpec
Creates a SnapshotSpec from the ResourceV3s in the given DeploymentV3.
func FromSnapshot ¶
func FromSnapshot(s *deploy.Snapshot) *SnapshotSpec
Creates a SnapshotSpec from the given deploy.Snapshot.
func (*SnapshotSpec) AddProvider ¶
func (s *SnapshotSpec) AddProvider(r *ResourceSpec)
Adds the given provider to the snapshot's lookup table and list of resources.
func (*SnapshotSpec) AddResource ¶
func (s *SnapshotSpec) AddResource(r *ResourceSpec)
Adds the given resource to the snapshot.
func (*SnapshotSpec) AsSnapshot ¶
func (s *SnapshotSpec) AsSnapshot() *deploy.Snapshot
Returns a deploy.Snapshot representation of this SnapshotSpec, suitable for use in setting up a lifecycle test.
func (*SnapshotSpec) Pretty ¶
func (s *SnapshotSpec) Pretty(indent string) string
Implements PrettySpec.Pretty. Returns a human-readable string representation of this SnapshotSpec, suitable for use in debugging output and error messages.
type SnapshotSpecAction ¶
type SnapshotSpecAction string
The type of action to take when generating a resource in a snapshot.
const ( // Generate a new resource. SnapshotSpecNew SnapshotSpecAction = "snapshot.new" // Generate an old (deleted) version of an existing resource in the snapshot. SnapshotSpecOld SnapshotSpecAction = "snapshot.old" // Generate a provider resource. SnapshotSpecProvider SnapshotSpecAction = "snapshot.provider" )
type SnapshotSpecOptions ¶
type SnapshotSpecOptions struct { // A source DeploymentV3 from which resources should be taken literally, // skipping the generation process. SourceDeploymentV3 *apitype.DeploymentV3 // A generator for the maximum number of resources to generate in the snapshot. ResourceCount *rapid.Generator[int] // A generator for actions that should be taken when generating a snapshot. Action *rapid.Generator[SnapshotSpecAction] // A set of options for configuring the generation of resources in the snapshot. ResourceOpts ResourceSpecOptions }
A set of options for configuring the generation of a SnapshotSpec.
func (SnapshotSpecOptions) With ¶
func (sso SnapshotSpecOptions) With(overrides SnapshotSpecOptions) SnapshotSpecOptions
Returns a copy of the given SnapshotSpecOptions with the given overrides applied.
type StackSpecOptions ¶
A set of options for configuring stacks used by rapid.Generators in this package.
func (StackSpecOptions) With ¶
func (sso StackSpecOptions) With(overrides StackSpecOptions) StackSpecOptions
Returns a copy of the StackSpecOptions with the given overrides applied.