fixture

package
v0.0.0-...-06cc741 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: AGPL-3.0 Imports: 73 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlavorID         = "019532bb-5582-7608-9a08-bb742a8174aa"
	MinecraftVersion = "1.21.10"
)
View Source
const (
	ControlPlaneAddr = "localhost:9012"
	BaseImage        = "base-image:latest"
	OAuthClientID    = "public-functest-client"
	APITokenIssuer   = "functest-issuer.explorer.chunks.cloud"
)
View Source
const (
	OCIRegsitryUser = "spc"
	OCIRegistryPass = "test123"
)
View Source
const (
	Bucket = "explorer"
)

Variables

View Source
var (
	FakeCRIAddr   = "/run/fakecri/fakecri.sock"
	FakeAttachURL = "http://fake-attach-url"
)
View Source
var (
	EnvoyAdminAddr = "127.0.0.1:5555"
	DNSUpstream    = netip.MustParseAddrPort("127.0.0.1:53")
)
View Source
var CheckpointAPIAddr = "127.0.0.1:3012"
View Source
var CreateOptionsAll = CreateOptions{
	WithFlavors:        true,
	WithFlavorVersions: true,
	WithOwner:          true,
}

Functions

func Chunk

func Chunk(mod ...func(c *resource.Chunk)) resource.Chunk

func Flavor

func Flavor(mod ...func(f *resource.Flavor)) resource.Flavor

func FlavorVersion

func FlavorVersion(mod ...func(v *resource.FlavorVersion)) resource.FlavorVersion

func Instance

func Instance(mod ...func(i *resource.Instance)) resource.Instance

func NewS3Client

func NewS3Client(t *testing.T, ctx context.Context) *s3.Client

func Node

func Node() node.Node

func PlatformdClientConn

func PlatformdClientConn(t *testing.T) *grpc.ClientConn

func RunCheckpointAPIFixtures

func RunCheckpointAPIFixtures(t *testing.T, registryUser string, registryPass string)

func RunFakeCRI

func RunFakeCRI(t *testing.T)

func RunProxyAPIFixtures

func RunProxyAPIFixtures(ctx context.Context, t *testing.T)

func RunRegistry

func RunRegistry(t *testing.T) string

func RunWorkloadAPIFixtures

func RunWorkloadAPIFixtures(t *testing.T)

func User

func User(mod ...func(c *resource.User)) resource.User

func Workload

func Workload() workloadv1alpha2.Workload

Types

type ControlPlane

type ControlPlane struct {
	Postgres   *Postgres
	IDP        *IDP
	SigningKey *ecdsa.PrivateKey
}

func NewControlPlane

func NewControlPlane(t *testing.T) ControlPlane

func (ControlPlane) AddUserAPIKey

func (c ControlPlane) AddUserAPIKey(t *testing.T, ctx *context.Context, u resource.User)

AddUserAPIKey generates a new signed api token for the given user id and creates a grpc metadata pair that will be added to the passed context.

func (ControlPlane) ChunkClient

func (ControlPlane) InstanceClient

func (ControlPlane) Run

func (c ControlPlane) Run(t *testing.T, opts ...ControlPlaneRunOption)

func (ControlPlane) UserClient

type ControlPlaneRunOption

type ControlPlaneRunOption func(*ControlPlaneRunOptions)

func WithFakeS3Endpoint

func WithFakeS3Endpoint(endpoint string) ControlPlaneRunOption

func WithOCIRegistryEndpoint

func WithOCIRegistryEndpoint(endpoint string) ControlPlaneRunOption

type ControlPlaneRunOptions

type ControlPlaneRunOptions struct {
	OCIRegistryEndpoint string
	FakeS3Endpoint      string
}

type CreateOptions

type CreateOptions struct {
	WithFlavors        bool
	WithFlavorVersions bool
	WithOwner          bool
}

type FakeCRI

type FakeCRI struct {
	runtimev1.UnimplementedRuntimeServiceServer
	runtimev1.UnimplementedImageServiceServer
	// contains filtered or unexported fields
}

func (*FakeCRI) Attach

func (*FakeCRI) ListImages

func (*FakeCRI) ListPodSandbox

func (*FakeCRI) PullImage

func (*FakeCRI) RunPodSandbox

func (*FakeCRI) StartContainer

type FakeS3

type FakeS3 struct {
	Endpoint string
	// contains filtered or unexported fields
}

func RunFakeS3

func RunFakeS3(t *testing.T) FakeS3

func (FakeS3) UploadObject

func (f FakeS3) UploadObject(t *testing.T, key string, data []byte)

type IDP

type IDP struct {
	Endpoint string
}

func NewIDP

func NewIDP() *IDP

func (*IDP) IDToken

func (i *IDP) IDToken(t *testing.T) string

func (*IDP) Run

func (i *IDP) Run(t *testing.T)

type Postgres

type Postgres struct {
	DB         *postgres.DB
	Pool       *pgxpool.Pool
	ConnString string
	// contains filtered or unexported fields
}

func NewPostgres

func NewPostgres() *Postgres

func (*Postgres) CreateChunk

func (p *Postgres) CreateChunk(t *testing.T, c *resource.Chunk, opts CreateOptions)

CreateChunk inserts a chunk and all flavors. it also updates the passed object so that dynamically generated values of fields like id or created_at have the correct value.

func (*Postgres) CreateFlavor

func (p *Postgres) CreateFlavor(t *testing.T, chunkID string, f *resource.Flavor, opts CreateOptions)

CreateFlavor inserts a flavor. it also updates the passed object so that dynamically generated values of fields like id or created_at have the correct value.

func (*Postgres) CreateFlavorVersion

func (p *Postgres) CreateFlavorVersion(t *testing.T, flavorID string, version *resource.FlavorVersion)

func (*Postgres) CreateInstance

func (p *Postgres) CreateInstance(t *testing.T, nodeID string, ins *resource.Instance)

CreateInstance inserts an instance and the chunk as well as all flavors belonging to the chunk. it also updates the passed object so that dynamically generated values of fields like id or created_at have the correct value.

func (*Postgres) CreateRiverClient

func (p *Postgres) CreateRiverClient(t *testing.T)

CreateRiverClient creates a new river client calling controlplane.CreateRiverClient and assigning it to the postgres.DB instance wrapped by this struct. do not call this function if you are using postgres in combination with the control plane fixture as this could override the river client set by the control plane.

also needs to be called AFTER Postgres.Run.

func (*Postgres) CreateUser

func (p *Postgres) CreateUser(t *testing.T, u *resource.User)

func (*Postgres) InsertNode

func (p *Postgres) InsertNode(t *testing.T)

func (*Postgres) Run

func (p *Postgres) Run(t *testing.T, ctx context.Context)

Jump to

Keyboard shortcuts

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