Documentation
¶
Index ¶
- func AllocateNetworks(t testing.TB, testStore *testStore, nws []*apiv2.NetworkServiceCreateRequest) map[string]*apiv2.Network
- func CreateFilesystemLayouts(t testing.TB, testStore *testStore, ...) map[string]*apiv2.FilesystemLayout
- func CreateIPs(t testing.TB, testStore *testStore, ips []*apiv2.IPServiceCreateRequest) map[string]*apiv2.IP
- func CreateImages(t testing.TB, testStore *testStore, ...) map[string]*apiv2.Image
- func CreateMachines(t testing.TB, testStore *testStore, machines []*metal.Machine) map[string]*metal.Machine
- func CreateMachinesWithAllocation(t testing.TB, testStore *testStore, ...) map[string]*apiv2.Machine
- func CreateNetworks(t testing.TB, testStore *testStore, nws []*adminv2.NetworkServiceCreateRequest) map[string]*apiv2.Network
- func CreatePartitions(t testing.TB, testStore *testStore, ...) map[string]*apiv2.Partition
- func CreateProjectInvites(t testing.TB, testStore *testStore, invites []*apiv2.ProjectInvite)
- func CreateProjectMemberships(t testing.TB, testStore *testStore, project string, ...)
- func CreateProjects(t testing.TB, testStore *testStore, ...) map[string]string
- func CreateSizeImageConstraints(t testing.TB, testStore *testStore, ...) map[string]*apiv2.SizeImageConstraint
- func CreateSizeReservations(t testing.TB, testStore *testStore, ...) map[string]*apiv2.SizeReservation
- func CreateSizes(t testing.TB, testStore *testStore, sizes []*adminv2.SizeServiceCreateRequest) map[string]*apiv2.Size
- func CreateSwitchStatuses(t testing.TB, testStore *testStore, statuses []*api.SwitchStatus) map[string]*metal.SwitchStatus
- func CreateSwitches(t testing.TB, testStore *testStore, switches []*api.SwitchServiceCreateRequest) map[string]*apiv2.Switch
- func CreateTenantInvites(t testing.TB, testStore *testStore, invites []*apiv2.TenantInvite)
- func CreateTenantMemberships(t testing.TB, testStore *testStore, tenant string, ...)
- func CreateTenants(t testing.TB, testStore *testStore, ...) []string
- func DeleteIPs(t testing.TB, testStore *testStore)
- func DeleteMachines(t testing.TB, testStore *testStore)
- func DeleteNetworks(t testing.TB, testStore *testStore)
- func DhcpMachines(t testing.TB, testStore *testStore, ...)
- func RegisterMachines(t testing.TB, testStore *testStore, ...)
- func StartAsynqServer(t testing.TB, log *slog.Logger, repository *repository.Store, ...) func()
- func StartHeadscale(t testing.TB) (*headscale.Client, string, func())
- func StartIpam(t testing.TB) (ipamv1connect.IpamServiceClient, func())
- func StartMasterdataInMemory(t testing.TB, log *slog.Logger) (mdc.Client, *grpc.ClientConn, func())
- func StartMasterdataWithPostgres(t testing.TB, log *slog.Logger) (mdc.Client, *grpc.ClientConn, func())
- func StartRepositoryWithCleanup(t testing.TB, log *slog.Logger, testOpts ...testOpt) (*testStore, func())
- func StartRethink(t testing.TB, log *slog.Logger) (generic.Datastore, r.ConnectOpts, func())
- func StartValkey(t testing.TB, testOpts ...testOpt) (*redis.Client, valkeygo.Client, func())
- func Validate(t *testing.T, msg proto.Message, options ...protovalidate.ValidationOption)
- func WithContainers(with bool) *testOptContainer
- func WithHeadscale(with bool) *testOptHeadscale
- func WithMiniRedis(with bool) *testOptMiniRedis
- func WithPostgres(with bool) *testOptPostgres
- func WithRethink(with bool) *testOptRethink
- func WithValkey(with bool) *testOptValkey
- type Asserters
- type Datacenter
- func (dc *Datacenter) Assert(mods *Asserters, opts ...cmp.Option) error
- func (dc *Datacenter) Cleanup()
- func (dc *Datacenter) Close()
- func (dc *Datacenter) Create(spec *scenarios.DatacenterSpec)
- func (dc *Datacenter) GetIPs() map[string]*apiv2.IP
- func (dc *Datacenter) GetImages() map[string]*apiv2.Image
- func (dc *Datacenter) GetMachines() map[string]*apiv2.Machine
- func (dc *Datacenter) GetNetworks() map[string]*apiv2.Network
- func (dc *Datacenter) GetPartitions() map[string]*apiv2.Partition
- func (dc *Datacenter) GetProjects() map[string][]*apiv2.Project
- func (dc *Datacenter) GetSizes() map[string]*apiv2.Size
- func (dc *Datacenter) GetSwitchStatuses() map[string]*metal.SwitchStatus
- func (dc *Datacenter) GetSwitches() map[string]*apiv2.Switch
- func (dc *Datacenter) GetTenants() map[string]*apiv2.Tenant
- func (dc *Datacenter) GetTestStore() *testStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllocateNetworks ¶ added in v0.0.3
func CreateFilesystemLayouts ¶ added in v0.0.6
func CreateFilesystemLayouts(t testing.TB, testStore *testStore, fsls []*adminv2.FilesystemServiceCreateRequest) map[string]*apiv2.FilesystemLayout
func CreateImages ¶
func CreateMachines ¶ added in v0.0.6
func CreateMachinesWithAllocation ¶ added in v0.0.6
func CreateNetworks ¶
func CreatePartitions ¶
func CreateProjectInvites ¶ added in v0.0.6
func CreateProjectInvites(t testing.TB, testStore *testStore, invites []*apiv2.ProjectInvite)
func CreateProjectMemberships ¶ added in v0.0.6
func CreateProjectMemberships(t testing.TB, testStore *testStore, project string, memberships []*api.ProjectMemberCreateRequest)
func CreateProjects ¶
func CreateSizeImageConstraints ¶ added in v0.1.7
func CreateSizeImageConstraints(t testing.TB, testStore *testStore, sizeImageConstraints []*adminv2.SizeImageConstraintServiceCreateRequest) map[string]*apiv2.SizeImageConstraint
func CreateSizeReservations ¶ added in v0.1.3
func CreateSizeReservations(t testing.TB, testStore *testStore, sizeReservations []*adminv2.SizeReservationServiceCreateRequest) map[string]*apiv2.SizeReservation
func CreateSizes ¶ added in v0.0.5
func CreateSwitchStatuses ¶ added in v0.1.0
func CreateSwitchStatuses(t testing.TB, testStore *testStore, statuses []*api.SwitchStatus) map[string]*metal.SwitchStatus
func CreateSwitches ¶ added in v0.0.8
func CreateTenantInvites ¶ added in v0.0.6
func CreateTenantInvites(t testing.TB, testStore *testStore, invites []*apiv2.TenantInvite)
func CreateTenantMemberships ¶ added in v0.0.6
func CreateTenantMemberships(t testing.TB, testStore *testStore, tenant string, memberships []*api.TenantMemberCreateRequest)
func CreateTenants ¶
func CreateTenants(t testing.TB, testStore *testStore, tenants []*apiv2.TenantServiceCreateRequest) []string
func DeleteMachines ¶ added in v0.0.6
func DeleteNetworks ¶ added in v0.0.3
func DhcpMachines ¶ added in v0.1.5
func DhcpMachines(t testing.TB, testStore *testStore, bootRequests []*infrav2.BootServiceDhcpRequest)
func RegisterMachines ¶ added in v0.1.5
func RegisterMachines(t testing.TB, testStore *testStore, registerRequests []*infrav2.BootServiceRegisterRequest)
func StartAsynqServer ¶ added in v0.0.3
func StartHeadscale ¶ added in v0.1.2
func StartIpam ¶
func StartIpam(t testing.TB) (ipamv1connect.IpamServiceClient, func())
func StartMasterdataInMemory ¶
func StartMasterdataWithPostgres ¶ added in v0.1.1
func StartRepositoryWithCleanup ¶ added in v0.0.3
func StartRethink ¶
func StartValkey ¶
func Validate ¶ added in v0.0.8
func Validate(t *testing.T, msg proto.Message, options ...protovalidate.ValidationOption)
func WithContainers ¶ added in v0.1.6
func WithContainers(with bool) *testOptContainer
WithContainers if set to false, no database containers are started, defaults to true.
func WithHeadscale ¶ added in v0.1.9
func WithHeadscale(with bool) *testOptHeadscale
WithRethink if set to true a rethink database container is started, defaults to false.
func WithMiniRedis ¶ added in v0.1.2
func WithMiniRedis(with bool) *testOptMiniRedis
func WithPostgres ¶ added in v0.1.1
func WithPostgres(with bool) *testOptPostgres
WithPostgres if set to true a postgres database container is started, defaults to false.
func WithRethink ¶ added in v0.1.6
func WithRethink(with bool) *testOptRethink
WithRethink if set to true a rethink database container is started, defaults to false.
func WithValkey ¶ added in v0.0.6
func WithValkey(with bool) *testOptValkey
WithValkey if set to true a valkey database container is started, defaults to false.
Types ¶
type Asserters ¶ added in v0.1.8
type Asserters struct {
Tenants func(tenants map[string]*apiv2.Tenant)
Projects func(projects map[string][]*apiv2.Project)
Partitions func(partitions map[string]*apiv2.Partition)
Sizes func(sizes map[string]*apiv2.Size)
Networks func(networks map[string]*apiv2.Network)
IPs func(ips map[string]*apiv2.IP)
Images func(images map[string]*apiv2.Image)
Switches func(switches map[string]*apiv2.Switch)
SwitchStatuses func(switchStatuses map[string]*metal.SwitchStatus)
Machines func(machines map[string]*apiv2.Machine)
}
type Datacenter ¶ added in v0.1.5
type Datacenter struct {
// contains filtered or unexported fields
}
func NewDatacenter ¶ added in v0.1.5
func NewDatacenter(t testing.TB, log *slog.Logger, testOpts ...testOpt) *Datacenter
func (*Datacenter) Assert ¶ added in v0.1.8
func (dc *Datacenter) Assert(mods *Asserters, opts ...cmp.Option) error
Assert tests whether all of the intended changes (and no others) were applied to the database.
Usage:
Define modifier functions that express what changes you expect the functions you are testing to apply to the database. Run the functions you are testing. Call dc.Assert(mods) with the modifiers you defined. Assert will fetch all current entities from the database and apply the modifications to the current datacenter. If the results differ Assert will return an error containing the diff. A `-` in the diff indicates a field that was expected but is not present in the database. A `+` in the diff indicates a field that was unexpectedly present in the database.
func (*Datacenter) Cleanup ¶ added in v0.1.8
func (dc *Datacenter) Cleanup()
func (*Datacenter) Close ¶ added in v0.1.5
func (dc *Datacenter) Close()
func (*Datacenter) Create ¶ added in v0.1.5
func (dc *Datacenter) Create(spec *scenarios.DatacenterSpec)
func (*Datacenter) GetImages ¶ added in v0.1.8
func (dc *Datacenter) GetImages() map[string]*apiv2.Image
func (*Datacenter) GetMachines ¶ added in v0.1.8
func (dc *Datacenter) GetMachines() map[string]*apiv2.Machine
func (*Datacenter) GetNetworks ¶ added in v0.1.8
func (dc *Datacenter) GetNetworks() map[string]*apiv2.Network
func (*Datacenter) GetPartitions ¶ added in v0.1.8
func (dc *Datacenter) GetPartitions() map[string]*apiv2.Partition
func (*Datacenter) GetProjects ¶ added in v0.1.8
func (dc *Datacenter) GetProjects() map[string][]*apiv2.Project
func (*Datacenter) GetSizes ¶ added in v0.1.8
func (dc *Datacenter) GetSizes() map[string]*apiv2.Size
func (*Datacenter) GetSwitchStatuses ¶ added in v0.1.8
func (dc *Datacenter) GetSwitchStatuses() map[string]*metal.SwitchStatus
func (*Datacenter) GetSwitches ¶ added in v0.1.8
func (dc *Datacenter) GetSwitches() map[string]*apiv2.Switch
func (*Datacenter) GetTenants ¶ added in v0.1.8
func (dc *Datacenter) GetTenants() map[string]*apiv2.Tenant
func (*Datacenter) GetTestStore ¶ added in v0.1.8
func (dc *Datacenter) GetTestStore() *testStore