testing

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

TODO: credits (based on fake_image_service.go and cri_stats_provider_test.go from k8s)

TODO: credits (based on fake_image_service.go and cri_stats_provider_test.go from k8s)

Index

Constants

This section is empty.

Variables

View Source
var (
	FakeRuntimeName  = "fakeRuntime"
	FakePodSandboxIP = "192.168.192.168"
)

Functions

func BuildContainerName110 added in v0.11.0

func BuildContainerName110(metadata *runtimeapi.ContainerMetadata, sandboxID string) string

func BuildContainerName19 added in v0.11.0

func BuildContainerName19(metadata *runtimeapi.ContainerMetadata, sandboxID string) string

func BuildSandboxName110 added in v0.11.0

func BuildSandboxName110(metadata *runtimeapi.PodSandboxMetadata) string

func BuildSandboxName19 added in v0.11.0

func BuildSandboxName19(metadata *runtimeapi.PodSandboxMetadata) string

func MakeFakeContainerStats110 added in v0.11.0

func MakeFakeContainerStats110(id string, metadata *runtimeapi.ContainerMetadata, imageFsUUID string) *runtimeapi.ContainerStats

func MakeFakeContainerStats19 added in v0.11.0

func MakeFakeContainerStats19(id string, metadata *runtimeapi.ContainerMetadata, imageFsUUID string) *runtimeapi.ContainerStats

func MakeFakeImageFsUsage110 added in v0.11.0

func MakeFakeImageFsUsage110(fsUUID string) *runtimeapi.FilesystemUsage

func MakeFakeImageFsUsage19 added in v0.11.0

func MakeFakeImageFsUsage19(fsUUID string) *runtimeapi.FilesystemUsage

Types

type FakeContainer110 added in v0.11.0

type FakeContainer110 struct {
	// ContainerStatus contains the runtime information for a container.
	runtimeapi.ContainerStatus

	// the sandbox id of this container
	SandboxID string
}

type FakeContainer19 added in v0.11.0

type FakeContainer19 struct {
	// ContainerStatus contains the runtime information for a container.
	runtimeapi.ContainerStatus

	// the sandbox id of this container
	SandboxID string
}

type FakeCriServer

type FakeCriServer interface {
	Serve(addr string, readyCh chan struct{}) error
	Stop()
	SetFakeImages(images []string)
	SetFakeImageSize(size uint64)
	SetFakeContainerStats(containerId, containerName, imageFsUUID string) interface{}
	SetFakeFilesystemUsage(imageFsUUID string) interface{}
	CurrentTime() int64
}

func NewFakeCriServer110 added in v0.11.0

func NewFakeCriServer110(journal Journal, streamUrl string) FakeCriServer

func NewFakeCriServer19 added in v0.11.0

func NewFakeCriServer19(journal Journal, streamUrl string) FakeCriServer

type FakeCriServer110 added in v0.11.0

type FakeCriServer110 struct {
	*FakeRuntimeServer110
	*FakeImageServer110
	// contains filtered or unexported fields
}

func (*FakeCriServer110) CurrentTime added in v0.11.0

func (s *FakeCriServer110) CurrentTime() int64

func (FakeCriServer110) Serve added in v0.11.0

func (s FakeCriServer110) Serve(addr string, readyCh chan struct{}) error

func (*FakeCriServer110) SetFakeContainerStats added in v0.11.0

func (s *FakeCriServer110) SetFakeContainerStats(containerId, containerName, imageFsUUID string) interface{}

func (*FakeCriServer110) SetFakeFilesystemUsage added in v0.11.0

func (s *FakeCriServer110) SetFakeFilesystemUsage(imageFsUUID string) interface{}

func (FakeCriServer110) Stop added in v0.11.0

func (s FakeCriServer110) Stop()

type FakeCriServer19 added in v0.11.0

type FakeCriServer19 struct {
	*FakeRuntimeServer19
	*FakeImageServer19
	// contains filtered or unexported fields
}

func (*FakeCriServer19) CurrentTime added in v0.11.0

func (s *FakeCriServer19) CurrentTime() int64

func (FakeCriServer19) Serve added in v0.11.0

func (s FakeCriServer19) Serve(addr string, readyCh chan struct{}) error

func (*FakeCriServer19) SetFakeContainerStats added in v0.11.0

func (s *FakeCriServer19) SetFakeContainerStats(containerId, containerName, imageFsUUID string) interface{}

func (*FakeCriServer19) SetFakeFilesystemUsage added in v0.11.0

func (s *FakeCriServer19) SetFakeFilesystemUsage(imageFsUUID string) interface{}

func (FakeCriServer19) Stop added in v0.11.0

func (s FakeCriServer19) Stop()

type FakeImageServer110 added in v0.11.0

type FakeImageServer110 struct {
	sync.Mutex

	FakeImageSize uint64
	Images        map[string]*runtimeapi.Image

	FakeFilesystemUsage []*runtimeapi.FilesystemUsage
	// contains filtered or unexported fields
}

func NewFakeImageServer110 added in v0.11.0

func NewFakeImageServer110(journal Journal) *FakeImageServer110

func (*FakeImageServer110) ImageFsInfo added in v0.11.0

func (*FakeImageServer110) ImageStatus added in v0.11.0

func (*FakeImageServer110) ListImages added in v0.11.0

func (*FakeImageServer110) PullImage added in v0.11.0

func (*FakeImageServer110) RemoveImage added in v0.11.0

func (*FakeImageServer110) SetFakeFilesystemUsage added in v0.11.0

func (r *FakeImageServer110) SetFakeFilesystemUsage(usage []*runtimeapi.FilesystemUsage)

func (*FakeImageServer110) SetFakeImageSize added in v0.11.0

func (r *FakeImageServer110) SetFakeImageSize(size uint64)

func (*FakeImageServer110) SetFakeImages added in v0.11.0

func (r *FakeImageServer110) SetFakeImages(images []string)

type FakeImageServer19 added in v0.11.0

type FakeImageServer19 struct {
	sync.Mutex

	FakeImageSize uint64
	Images        map[string]*runtimeapi.Image

	FakeFilesystemUsage []*runtimeapi.FilesystemUsage
	// contains filtered or unexported fields
}

func NewFakeImageServer19 added in v0.11.0

func NewFakeImageServer19(journal Journal) *FakeImageServer19

func (*FakeImageServer19) ImageFsInfo added in v0.11.0

func (*FakeImageServer19) ImageStatus added in v0.11.0

func (*FakeImageServer19) ListImages added in v0.11.0

func (*FakeImageServer19) PullImage added in v0.11.0

func (*FakeImageServer19) RemoveImage added in v0.11.0

func (*FakeImageServer19) SetFakeFilesystemUsage added in v0.11.0

func (r *FakeImageServer19) SetFakeFilesystemUsage(usage []*runtimeapi.FilesystemUsage)

func (*FakeImageServer19) SetFakeImageSize added in v0.11.0

func (r *FakeImageServer19) SetFakeImageSize(size uint64)

func (*FakeImageServer19) SetFakeImages added in v0.11.0

func (r *FakeImageServer19) SetFakeImages(images []string)

type FakePodSandbox110 added in v0.11.0

type FakePodSandbox110 struct {
	// PodSandboxStatus contains the runtime information for a sandbox.
	runtimeapi.PodSandboxStatus
}

type FakePodSandbox19 added in v0.11.0

type FakePodSandbox19 struct {
	// PodSandboxStatus contains the runtime information for a sandbox.
	runtimeapi.PodSandboxStatus
}

type FakeRuntimeServer110 added in v0.11.0

type FakeRuntimeServer110 struct {
	sync.Mutex

	CurrentTime        int64
	FakeStatus         *runtimeapi.RuntimeStatus
	Containers         map[string]*FakeContainer110
	Sandboxes          map[string]*FakePodSandbox110
	FakeContainerStats map[string]*runtimeapi.ContainerStats
	// contains filtered or unexported fields
}

func NewFakeRuntimeServer110 added in v0.11.0

func NewFakeRuntimeServer110(journal Journal, streamUrl string) *FakeRuntimeServer110

func (*FakeRuntimeServer110) Attach added in v0.11.0

func (*FakeRuntimeServer110) ContainerStats added in v0.11.0

func (*FakeRuntimeServer110) ContainerStatus added in v0.11.0

func (*FakeRuntimeServer110) CreateContainer added in v0.11.0

func (*FakeRuntimeServer110) Exec added in v0.11.0

func (*FakeRuntimeServer110) ExecSync added in v0.11.0

func (*FakeRuntimeServer110) ListContainerStats added in v0.11.0

func (*FakeRuntimeServer110) ListContainers added in v0.11.0

func (*FakeRuntimeServer110) ListPodSandbox added in v0.11.0

func (*FakeRuntimeServer110) PodSandboxStatus added in v0.11.0

func (*FakeRuntimeServer110) PortForward added in v0.11.0

func (*FakeRuntimeServer110) RemoveContainer added in v0.11.0

func (*FakeRuntimeServer110) RemovePodSandbox added in v0.11.0

func (*FakeRuntimeServer110) ReopenContainerLog added in v0.11.0

func (*FakeRuntimeServer110) RunPodSandbox added in v0.11.0

func (*FakeRuntimeServer110) SetFakeContainerStats added in v0.11.0

func (r *FakeRuntimeServer110) SetFakeContainerStats(containerStats []*runtimeapi.ContainerStats)

func (*FakeRuntimeServer110) SetFakeContainers added in v0.11.0

func (r *FakeRuntimeServer110) SetFakeContainers(containers []*FakeContainer110)

func (*FakeRuntimeServer110) SetFakeSandboxes added in v0.11.0

func (r *FakeRuntimeServer110) SetFakeSandboxes(sandboxes []*FakePodSandbox110)

func (*FakeRuntimeServer110) StartContainer added in v0.11.0

func (*FakeRuntimeServer110) Status added in v0.11.0

func (*FakeRuntimeServer110) StopContainer added in v0.11.0

func (*FakeRuntimeServer110) StopPodSandbox added in v0.11.0

func (*FakeRuntimeServer110) UpdateContainerResources added in v0.11.0

func (*FakeRuntimeServer110) UpdateRuntimeConfig added in v0.11.0

func (*FakeRuntimeServer110) Version added in v0.11.0

type FakeRuntimeServer19 added in v0.11.0

type FakeRuntimeServer19 struct {
	sync.Mutex

	CurrentTime        int64
	FakeStatus         *runtimeapi.RuntimeStatus
	Containers         map[string]*FakeContainer19
	Sandboxes          map[string]*FakePodSandbox19
	FakeContainerStats map[string]*runtimeapi.ContainerStats
	// contains filtered or unexported fields
}

func NewFakeRuntimeServer19 added in v0.11.0

func NewFakeRuntimeServer19(journal Journal, streamUrl string) *FakeRuntimeServer19

func (*FakeRuntimeServer19) Attach added in v0.11.0

func (*FakeRuntimeServer19) ContainerStats added in v0.11.0

func (*FakeRuntimeServer19) ContainerStatus added in v0.11.0

func (*FakeRuntimeServer19) CreateContainer added in v0.11.0

func (*FakeRuntimeServer19) Exec added in v0.11.0

func (*FakeRuntimeServer19) ExecSync added in v0.11.0

func (*FakeRuntimeServer19) ListContainerStats added in v0.11.0

func (*FakeRuntimeServer19) ListContainers added in v0.11.0

func (*FakeRuntimeServer19) ListPodSandbox added in v0.11.0

func (*FakeRuntimeServer19) PodSandboxStatus added in v0.11.0

func (*FakeRuntimeServer19) PortForward added in v0.11.0

func (*FakeRuntimeServer19) RemoveContainer added in v0.11.0

func (*FakeRuntimeServer19) RemovePodSandbox added in v0.11.0

func (*FakeRuntimeServer19) RunPodSandbox added in v0.11.0

func (*FakeRuntimeServer19) SetFakeContainerStats added in v0.11.0

func (r *FakeRuntimeServer19) SetFakeContainerStats(containerStats []*runtimeapi.ContainerStats)

func (*FakeRuntimeServer19) SetFakeContainers added in v0.11.0

func (r *FakeRuntimeServer19) SetFakeContainers(containers []*FakeContainer19)

func (*FakeRuntimeServer19) SetFakeSandboxes added in v0.11.0

func (r *FakeRuntimeServer19) SetFakeSandboxes(sandboxes []*FakePodSandbox19)

func (*FakeRuntimeServer19) StartContainer added in v0.11.0

func (*FakeRuntimeServer19) Status added in v0.11.0

func (*FakeRuntimeServer19) StopContainer added in v0.11.0

func (*FakeRuntimeServer19) StopPodSandbox added in v0.11.0

func (*FakeRuntimeServer19) UpdateContainerResources added in v0.11.0

func (*FakeRuntimeServer19) UpdateRuntimeConfig added in v0.11.0

func (*FakeRuntimeServer19) Version added in v0.11.0

type Journal

type Journal interface {
	// Record saves the specified item in the journal
	Record(item string)
}

Journal records a series of events (items) represented as strings in a thread-safe way

type PrefixJournal

type PrefixJournal struct {
	// contains filtered or unexported fields
}

PrefixJournal is an implementation of Journal interface that prefixes every item passed to it with the specified prefix before passing it on to the underlying Journal

func NewPrefixJournal

func NewPrefixJournal(journal Journal, prefix string) *PrefixJournal

NewPrefixJournal creates an instance of PrefixJournal with the specified underlying journal and prefix

func (*PrefixJournal) Record

func (j *PrefixJournal) Record(item string)

Record implements Record method of Journal interface

type SimpleJournal

type SimpleJournal struct {
	sync.Mutex
	Items []string
	// contains filtered or unexported fields
}

SimpleJournal is an implementation of Journal that has methods for waiting for particular events and verifying journal contents

func NewSimpleJournal

func NewSimpleJournal() *SimpleJournal

NewSimpleJournal creates an instance of SimpleJournal

func (*SimpleJournal) Record

func (j *SimpleJournal) Record(item string)

Record implements Record method of Journal interface

func (*SimpleJournal) Skip added in v0.11.0

func (j *SimpleJournal) Skip(item string)

Skip makes SimpleJournal skip the specified items when they occur

func (*SimpleJournal) Verify

func (j *SimpleJournal) Verify(expectedItems []string) error

Verify verifies that the current contents of the journal is expectedItems, returns nil if so or an error otherwise

Jump to

Keyboard shortcuts

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