container

package
v0.0.0-...-1e8dc9b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseContainerID

func ParseContainerID(id string) (containerID string, runtime string, err error)

ParseContainerID extract from given id the containerID and runtime

Types

type Config

type Config struct {
	Runtime Runtime
}

Config contains needed interfaces

type Container

type Container interface {
	ID() string
	Runtime() Runtime
	PID() uint32
	Name() string
}

Container describes a container

func New

func New(id, name string) (Container, error)

New creates a new container object with default config

func NewWithConfig

func NewWithConfig(id, name string, config Config) (Container, error)

NewWithConfig creates a new container object with the given config nil fields are defaulted

type ContainerMock

type ContainerMock struct {
	mock.Mock
}

ContainerMock is an autogenerated mock type for the Container type

func NewContainerMock

func NewContainerMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *ContainerMock

NewContainerMock creates a new instance of ContainerMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*ContainerMock) EXPECT

func (_m *ContainerMock) EXPECT() *ContainerMock_Expecter

func (*ContainerMock) ID

func (_m *ContainerMock) ID() string

ID provides a mock function with given fields:

func (*ContainerMock) Name

func (_m *ContainerMock) Name() string

Name provides a mock function with given fields:

func (*ContainerMock) PID

func (_m *ContainerMock) PID() uint32

PID provides a mock function with given fields:

func (*ContainerMock) Runtime

func (_m *ContainerMock) Runtime() Runtime

Runtime provides a mock function with given fields:

type ContainerMock_Expecter

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

func (*ContainerMock_Expecter) ID

ID is a helper method to define mock.On call

func (*ContainerMock_Expecter) Name

Name is a helper method to define mock.On call

func (*ContainerMock_Expecter) PID

PID is a helper method to define mock.On call

func (*ContainerMock_Expecter) Runtime

Runtime is a helper method to define mock.On call

type ContainerMock_ID_Call

type ContainerMock_ID_Call struct {
	*mock.Call
}

ContainerMock_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID'

func (*ContainerMock_ID_Call) Return

func (*ContainerMock_ID_Call) Run

func (_c *ContainerMock_ID_Call) Run(run func()) *ContainerMock_ID_Call

func (*ContainerMock_ID_Call) RunAndReturn

func (_c *ContainerMock_ID_Call) RunAndReturn(run func() string) *ContainerMock_ID_Call

type ContainerMock_Name_Call

type ContainerMock_Name_Call struct {
	*mock.Call
}

ContainerMock_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'

func (*ContainerMock_Name_Call) Return

func (*ContainerMock_Name_Call) Run

func (_c *ContainerMock_Name_Call) Run(run func()) *ContainerMock_Name_Call

func (*ContainerMock_Name_Call) RunAndReturn

func (_c *ContainerMock_Name_Call) RunAndReturn(run func() string) *ContainerMock_Name_Call

type ContainerMock_PID_Call

type ContainerMock_PID_Call struct {
	*mock.Call
}

ContainerMock_PID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PID'

func (*ContainerMock_PID_Call) Return

func (*ContainerMock_PID_Call) Run

func (_c *ContainerMock_PID_Call) Run(run func()) *ContainerMock_PID_Call

func (*ContainerMock_PID_Call) RunAndReturn

func (_c *ContainerMock_PID_Call) RunAndReturn(run func() uint32) *ContainerMock_PID_Call

type ContainerMock_Runtime_Call

type ContainerMock_Runtime_Call struct {
	*mock.Call
}

ContainerMock_Runtime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Runtime'

func (*ContainerMock_Runtime_Call) Return

func (*ContainerMock_Runtime_Call) Run

func (*ContainerMock_Runtime_Call) RunAndReturn

func (_c *ContainerMock_Runtime_Call) RunAndReturn(run func() Runtime) *ContainerMock_Runtime_Call

type Runtime

type Runtime interface {
	PID(id string) (uint32, error)
	HostPath(id, path string) (string, error)
}

Runtime is an interface abstracting a container runtime being able to return a container PID from its ID

type RuntimeMock

type RuntimeMock struct {
	mock.Mock
}

RuntimeMock is an autogenerated mock type for the Runtime type

func NewRuntimeMock

func NewRuntimeMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *RuntimeMock

NewRuntimeMock creates a new instance of RuntimeMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*RuntimeMock) EXPECT

func (_m *RuntimeMock) EXPECT() *RuntimeMock_Expecter

func (*RuntimeMock) HostPath

func (_m *RuntimeMock) HostPath(id string, path string) (string, error)

HostPath provides a mock function with given fields: id, path

func (*RuntimeMock) PID

func (_m *RuntimeMock) PID(id string) (uint32, error)

PID provides a mock function with given fields: id

type RuntimeMock_Expecter

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

func (*RuntimeMock_Expecter) HostPath

func (_e *RuntimeMock_Expecter) HostPath(id interface{}, path interface{}) *RuntimeMock_HostPath_Call

HostPath is a helper method to define mock.On call

  • id string
  • path string

func (*RuntimeMock_Expecter) PID

func (_e *RuntimeMock_Expecter) PID(id interface{}) *RuntimeMock_PID_Call

PID is a helper method to define mock.On call

  • id string

type RuntimeMock_HostPath_Call

type RuntimeMock_HostPath_Call struct {
	*mock.Call
}

RuntimeMock_HostPath_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HostPath'

func (*RuntimeMock_HostPath_Call) Return

func (*RuntimeMock_HostPath_Call) Run

func (*RuntimeMock_HostPath_Call) RunAndReturn

type RuntimeMock_PID_Call

type RuntimeMock_PID_Call struct {
	*mock.Call
}

RuntimeMock_PID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PID'

func (*RuntimeMock_PID_Call) Return

func (_c *RuntimeMock_PID_Call) Return(_a0 uint32, _a1 error) *RuntimeMock_PID_Call

func (*RuntimeMock_PID_Call) Run

func (_c *RuntimeMock_PID_Call) Run(run func(id string)) *RuntimeMock_PID_Call

func (*RuntimeMock_PID_Call) RunAndReturn

func (_c *RuntimeMock_PID_Call) RunAndReturn(run func(string) (uint32, error)) *RuntimeMock_PID_Call

Jump to

Keyboard shortcuts

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