fakeclient

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package fakeclient contains a fake implementation of the containerd client for testing purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	containerd.Container
	// contains filtered or unexported fields
}

Container is a fake implementation of the containerd container object.

func NewFakeContainer

func NewFakeContainer(id, image, digest, rootfs string) *Container

NewFakeContainer creates a new fake instance of containerd container.

func (*Container) ID

func (c *Container) ID() string

ID returns the container's unique id.

func (*Container) Image

func (c *Container) Image(ctx context.Context) (containerd.Image, error)

Image returns the underlying container Image object with a given digest.

func (*Container) Info

Info returns the underlying container record type.

func (*Container) Task

type CtrdClient

type CtrdClient struct {
	plugin.CtrdClient
	// contains filtered or unexported fields
}

CtrdClient is a fake implementation of CtrdClient for testing purposes.

func NewFakeCtrdClient

func NewFakeCtrdClient(ctx context.Context, nssTaskIDs map[string][]string, tsks []*task.Process, ctrs []containerd.Container) (CtrdClient, error)

NewFakeCtrdClient creates a new fake containerd client.

func (*CtrdClient) Close

func (c *CtrdClient) Close() error

Close is a no-op for the fake containerd client.

func (*CtrdClient) LoadContainer

func (c *CtrdClient) LoadContainer(ctx context.Context, id string) (containerd.Container, error)

LoadContainer returns the containerd.Container object for the given task ID from ctrTasksIDs.

func (*CtrdClient) NamespaceService

func (c *CtrdClient) NamespaceService() namespaces.Store

NamespaceService returns the fake namespaces service for testing purposes.

func (*CtrdClient) TaskService

func (c *CtrdClient) TaskService() tasks.TasksClient

TaskService returns the fake task service for testing purposes.

type Image

type Image struct {
	containerd.Image
	// contains filtered or unexported fields
}

Image is a fake implementation of the containerd image object.

func NewFakeImage

func NewFakeImage(digest string) *Image

NewFakeImage creates a new fake instance of containerd image.

func (*Image) Target

func (i *Image) Target() imagespecs.Descriptor

Target returns the image's target descriptor with the image's digest only.

type NamespacesService

type NamespacesService struct {
	namespaces.Store
	// contains filtered or unexported fields
}

NamespacesService is a fake implementation of the containerd namespaces service.

func NewFakeNamespacesService

func NewFakeNamespacesService(namespaces []string) *NamespacesService

NewFakeNamespacesService creates a new fake namespaces service.

func (*NamespacesService) List

func (s *NamespacesService) List(ctx context.Context) ([]string, error)

List returns a list of all namespaces that are stored in the fake namespaces service.

type Task

type Task struct {
	containerd.Task
	// contains filtered or unexported fields
}

Task is a fake implementation of the containerd task object.

func NewFakeTask

func NewFakeTask(rootfs string) *Task

NewFakeTask creates a new fake instance of containerd image.

func (*Task) Spec

func (t *Task) Spec(ctx context.Context) (*oci.Spec, error)

Spec returns the task runtime spec with the rootfs path only.

type TasksService

type TasksService struct {
	tasks.TasksClient
	// contains filtered or unexported fields
}

TasksService is a fake implementation of the containerd tasks service.

func NewFakeTasksService

func NewFakeTasksService(tasks []*task.Process, nssTaskIDs map[string][]string) *TasksService

NewFakeTasksService creates a new fake tasks service.

func (*TasksService) List

List returns a list of tasks for a namespace that is obtained from the context.

Jump to

Keyboard shortcuts

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