Documentation
¶
Index ¶
- Constants
- Variables
- func Chunk(mod ...func(c *resource.Chunk)) resource.Chunk
- func Flavor(mod ...func(f *resource.Flavor)) resource.Flavor
- func FlavorVersion(mod ...func(v *resource.FlavorVersion)) resource.FlavorVersion
- func Instance(mod ...func(i *resource.Instance)) resource.Instance
- func NewS3Client(t *testing.T, ctx context.Context) *s3.Client
- func Node() node.Node
- func PlatformdClientConn(t *testing.T) *grpc.ClientConn
- func RunCheckpointAPIFixtures(t *testing.T, registryUser string, registryPass string)
- func RunFakeCRI(t *testing.T)
- func RunProxyAPIFixtures(ctx context.Context, t *testing.T)
- func RunRegistry(t *testing.T) string
- func RunWorkloadAPIFixtures(t *testing.T)
- func User(mod ...func(c *resource.User)) resource.User
- func Workload() workloadv1alpha2.Workload
- type ControlPlane
- func (c ControlPlane) AddUserAPIKey(t *testing.T, ctx *context.Context, u resource.User)
- func (c ControlPlane) ChunkClient(t *testing.T) chunkv1alpha1.ChunkServiceClient
- func (c ControlPlane) InstanceClient(t *testing.T) instancev1alpha1.InstanceServiceClient
- func (c ControlPlane) Run(t *testing.T, opts ...ControlPlaneRunOption)
- func (c ControlPlane) UserClient(t *testing.T) userv1alpha1.UserServiceClient
- type ControlPlaneRunOption
- type ControlPlaneRunOptions
- type CreateOptions
- type FakeCRI
- func (f *FakeCRI) Attach(ctx context.Context, req *runtimev1.AttachRequest) (*runtimev1.AttachResponse, error)
- func (f *FakeCRI) CheckpointContainer(ctx context.Context, req *runtimev1.CheckpointContainerRequest) (*runtimev1.CheckpointContainerResponse, error)
- func (f *FakeCRI) CreateContainer(ctx context.Context, req *runtimev1.CreateContainerRequest) (*runtimev1.CreateContainerResponse, error)
- func (f *FakeCRI) ListImages(ctx context.Context, req *runtimev1.ListImagesRequest) (*runtimev1.ListImagesResponse, error)
- func (f *FakeCRI) ListPodSandbox(ctx context.Context, req *runtimev1.ListPodSandboxRequest) (*runtimev1.ListPodSandboxResponse, error)
- func (f *FakeCRI) PullImage(ctx context.Context, req *runtimev1.PullImageRequest) (*runtimev1.PullImageResponse, error)
- func (f *FakeCRI) RunPodSandbox(ctx context.Context, req *runtimev1.RunPodSandboxRequest) (*runtimev1.RunPodSandboxResponse, error)
- func (f *FakeCRI) StartContainer(ctx context.Context, req *runtimev1.StartContainerRequest) (*runtimev1.StartContainerResponse, error)
- type FakeS3
- type IDP
- type Postgres
- func (p *Postgres) CreateChunk(t *testing.T, c *resource.Chunk, opts CreateOptions)
- func (p *Postgres) CreateFlavor(t *testing.T, chunkID string, f *resource.Flavor, opts CreateOptions)
- func (p *Postgres) CreateFlavorVersion(t *testing.T, flavorID string, version *resource.FlavorVersion)
- func (p *Postgres) CreateInstance(t *testing.T, nodeID string, ins *resource.Instance)
- func (p *Postgres) CreateRiverClient(t *testing.T)
- func (p *Postgres) CreateUser(t *testing.T, u *resource.User)
- func (p *Postgres) InsertNode(t *testing.T)
- func (p *Postgres) Run(t *testing.T, ctx context.Context)
Constants ¶
const ( FlavorID = "019532bb-5582-7608-9a08-bb742a8174aa" MinecraftVersion = "1.21.10" )
const ( ControlPlaneAddr = "localhost:9012" BaseImage = "base-image:latest" OAuthClientID = "public-functest-client" APITokenIssuer = "functest-issuer.explorer.chunks.cloud" )
const ( OCIRegsitryUser = "spc" OCIRegistryPass = "test123" )
const (
Bucket = "explorer"
)
Variables ¶
var ( FakeCRIAddr = "/run/fakecri/fakecri.sock" FakeAttachURL = "http://fake-attach-url" )
var ( EnvoyAdminAddr = "127.0.0.1:5555" DNSUpstream = netip.MustParseAddrPort("127.0.0.1:53") )
var CheckpointAPIAddr = "127.0.0.1:3012"
var CreateOptionsAll = CreateOptions{ WithFlavors: true, WithFlavorVersions: true, WithOwner: true, }
Functions ¶
func FlavorVersion ¶
func FlavorVersion(mod ...func(v *resource.FlavorVersion)) resource.FlavorVersion
func PlatformdClientConn ¶
func PlatformdClientConn(t *testing.T) *grpc.ClientConn
func RunFakeCRI ¶
func RunRegistry ¶
func RunWorkloadAPIFixtures ¶
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 ¶
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 (c ControlPlane) ChunkClient(t *testing.T) chunkv1alpha1.ChunkServiceClient
func (ControlPlane) InstanceClient ¶
func (c ControlPlane) InstanceClient(t *testing.T) instancev1alpha1.InstanceServiceClient
func (ControlPlane) Run ¶
func (c ControlPlane) Run(t *testing.T, opts ...ControlPlaneRunOption)
func (ControlPlane) UserClient ¶
func (c ControlPlane) UserClient(t *testing.T) userv1alpha1.UserServiceClient
type ControlPlaneRunOption ¶
type ControlPlaneRunOption func(*ControlPlaneRunOptions)
func WithFakeS3Endpoint ¶
func WithFakeS3Endpoint(endpoint string) ControlPlaneRunOption
func WithOCIRegistryEndpoint ¶
func WithOCIRegistryEndpoint(endpoint string) ControlPlaneRunOption
type ControlPlaneRunOptions ¶
type CreateOptions ¶
type FakeCRI ¶
type FakeCRI struct {
runtimev1.UnimplementedRuntimeServiceServer
runtimev1.UnimplementedImageServiceServer
// contains filtered or unexported fields
}
func (*FakeCRI) Attach ¶
func (f *FakeCRI) Attach(ctx context.Context, req *runtimev1.AttachRequest) (*runtimev1.AttachResponse, error)
func (*FakeCRI) CheckpointContainer ¶
func (f *FakeCRI) CheckpointContainer( ctx context.Context, req *runtimev1.CheckpointContainerRequest, ) (*runtimev1.CheckpointContainerResponse, error)
func (*FakeCRI) CreateContainer ¶
func (f *FakeCRI) CreateContainer(ctx context.Context, req *runtimev1.CreateContainerRequest, ) (*runtimev1.CreateContainerResponse, error)
func (*FakeCRI) ListImages ¶
func (f *FakeCRI) ListImages(ctx context.Context, req *runtimev1.ListImagesRequest, ) (*runtimev1.ListImagesResponse, error)
func (*FakeCRI) ListPodSandbox ¶
func (f *FakeCRI) ListPodSandbox(ctx context.Context, req *runtimev1.ListPodSandboxRequest, ) (*runtimev1.ListPodSandboxResponse, error)
func (*FakeCRI) PullImage ¶
func (f *FakeCRI) PullImage(ctx context.Context, req *runtimev1.PullImageRequest, ) (*runtimev1.PullImageResponse, error)
func (*FakeCRI) RunPodSandbox ¶
func (f *FakeCRI) RunPodSandbox( ctx context.Context, req *runtimev1.RunPodSandboxRequest, ) (*runtimev1.RunPodSandboxResponse, error)
func (*FakeCRI) StartContainer ¶
func (f *FakeCRI) StartContainer(ctx context.Context, req *runtimev1.StartContainerRequest, ) (*runtimev1.StartContainerResponse, error)
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 ¶
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 (*Postgres) CreateInstance ¶
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 ¶
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.