test

package
v0.0.0-...-ebb3a86 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IgnoredProtoChunkFields = protocmp.IgnoreFields(
		&chunkv1alpha1.Chunk{},

		"id",
		"created_at",
		"updated_at",
	)

	IgnoredProtoFlavorVersionFields = protocmp.IgnoreFields(
		&chunkv1alpha1.FlavorVersion{},

		"id",
		"created_at",
	)

	IgnoredProtoFlavorFields = protocmp.IgnoreFields(
		&chunkv1alpha1.Flavor{},

		"id",
		"created_at",
		"updated_at",
	)

	IgnoredProtoInstanceFields = protocmp.IgnoreFields(
		&instancev1alpha1.Instance{},

		"id",
	)

	IgnoredInstanceFields = []string{

		"ID",
		"CreatedAt",
		"UpdatedAt",
		"ChunkFlavor.ID",
		"ChunkFlavor.CreatedAt",
		"ChunkFlavor.UpdatedAt",
		"Chunk.Flavors.ID",
		"Chunk.Flavors.CreatedAt",
		"Chunk.Flavors.UpdatedAt",
		"Chunk.ID",
		"Chunk.CreatedAt",
		"Chunk.UpdatedAt",
	}
)

Functions

func AddRandVethPair

func AddRandVethPair(t *testing.T) (*net.Interface, netlink.Link)

AddRandVethPair adds a veth pair with a random name. This is mostly used for tests where a dummy network interface is needed.

func CreateNetns

func CreateNetns(t *testing.T) (netns.NsHandle, string)

func GetLinkByNS

func GetLinkByNS(t *testing.T, name string, nsPath string) netlink.Link

func IgnoreFields

func IgnoreFields(fields ...string) cmp.Option

func ListProgs

func ListProgs(t *testing.T)

func NewUUIDv7

func NewUUIDv7(t *testing.T) string

func RandHexStr

func RandHexStr(t *testing.T) string

func RequireAddrConfigured

func RequireAddrConfigured(t *testing.T, ifaceName, expectedAddr string)

func SetCNIEnvVars

func SetCNIEnvVars(containerID, ifname, cniNetNS string)

SetCNIEnvVars sets environment variables needed in order to make cni IPAM plugin work.

func WaitServerReady

func WaitServerReady(t *testing.T, network, addr string, timeout time.Duration)

WaitServerReady waits until a process, usually some kind of server, can accept connections. Fails after no successful connection could be established after the timeout.

Types

type Env

type Env struct {
	ID      string
	Servers []*hcloud.Server
	// contains filtered or unexported fields
}

func NewEnv

func NewEnv(t *testing.T, hcloudToken string) *Env

func (*Env) Cleanup

func (e *Env) Cleanup(ctx context.Context)

func (*Env) CreateServer

func (e *Env) CreateServer(ctx context.Context) string

func (*Env) PrivateKeyPath

func (e *Env) PrivateKeyPath() string

func (*Env) SSHUser

func (e *Env) SSHUser() string

func (*Env) Setup

func (e *Env) Setup(ctx context.Context)

Setup the environment. Currently, this is: * generating and configuring an ed25519 key pair

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳