mock

package
v0.0.0-...-71cdb78 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddonRepository

type AddonRepository struct {
	URL       string
	Reference string
	Force     bool
}

AddonRepository is a mock for the current state of an addon repository.

type JoinClusterCall

type JoinClusterCall struct {
	URL    string
	Worker bool
}

JoinClusterCall is a mock for the join cluster call.

type RunCommandCall

type RunCommandCall struct {
	Commands []string
}

RunCommandCall contains the arguments passed to a specific call of the RunCommand method.

type Snap

type Snap struct {
	SnapDir       string
	SnapDataDir   string
	SnapCommonDir string
	CAPIDir       string

	RunCommandCalledWith []RunCommandCall
	RunCommandErr        error

	GroupName string

	EnableAddonCalledWith    []string
	DisableAddonCalledWith   []string
	RestartServiceCalledWith []string
	RunUpgradeCalledWith     []string // "{upgrade} {phase}"

	CA                string
	CAKey             string
	ServiceAccountKey string

	CNIYaml                string
	WriteCNIYamlCalledWith [][]byte
	ApplyCNICalled         []struct{}

	DqliteCert        string
	DqliteKey         string
	DqliteClusterYaml string
	DqliteInfoYaml    string

	WriteDqliteUpdateYamlCalledWith []string

	KubeconfigFile string

	KubeliteLock                       bool
	DqliteLock                         bool
	NoCertsReissueLock                 bool
	CreateNoCertsReissueLockCalledWith []struct{}

	ServiceArguments            map[string]string
	WriteServiceArgumentsCalled bool

	ClusterTokens            []string
	CertificateRequestTokens []string
	SelfCallbackTokens       []string

	AddPersistentClusterTokenCalledWith  []string
	AddCertificateRequestTokenCalledWith []string
	AddCallbackTokenCalledWith           []string // "{clusterAgentEndpoint} {token}"

	ConsumeClusterTokenCalledWith            []string
	ConsumeCertificateRequestTokenCalledWith []string

	SelfCallbackToken string
	KubeletTokens     map[string]string // map hostname to token
	KnownTokens       map[string]string // map username to token

	CAPIAuthTokenValid bool
	CAPIAuthTokenError error

	SignCertificateCalledWith []string // string(csrPEM)
	SignedCertificate         string

	ImportImageCalledWith []string // string(io.ReadAll(reader))

	CSRConfig string

	ContainerdRegistryConfigs map[string]string // map registry name to hosts.toml contents

	AddonRepositories map[string]AddonRepository

	JoinClusterCalledWith []JoinClusterCall

	EtcdCA, EtcdCert, EtcdKey string
}

Snap is a generic mock for the snap.Snap interface.

func (*Snap) AddAddonsRepository

func (s *Snap) AddAddonsRepository(ctx context.Context, name, url, reference string, force bool) error

AddAddonsRepository is a mock implementation for the snap.Snap interface.

func (*Snap) AddCallbackToken

func (s *Snap) AddCallbackToken(clusterAgentEndpoint string, token string) error

AddCallbackToken is a mock implementation for the snap.Snap interface.

func (*Snap) AddCertificateRequestToken

func (s *Snap) AddCertificateRequestToken(token string) error

AddCertificateRequestToken is a mock implementation for the snap.Snap interface.

func (*Snap) AddPersistentClusterToken

func (s *Snap) AddPersistentClusterToken(token string) error

AddPersistentClusterToken is a mock implementation for the snap.Snap interface.

func (*Snap) ApplyCNI

func (s *Snap) ApplyCNI(_ context.Context) error

ApplyCNI is a mock implementation for the snap.Snap interface.

func (*Snap) ConsumeCertificateRequestToken

func (s *Snap) ConsumeCertificateRequestToken(token string) bool

ConsumeCertificateRequestToken is a mock implementation for the snap.Snap interface.

func (*Snap) ConsumeClusterToken

func (s *Snap) ConsumeClusterToken(token string) bool

ConsumeClusterToken is a mock implementation for the snap.Snap interface.

func (*Snap) ConsumeSelfCallbackToken

func (s *Snap) ConsumeSelfCallbackToken(token string) bool

ConsumeSelfCallbackToken is a mock implementation for the snap.Snap interface.

func (*Snap) CreateNoCertsReissueLock

func (s *Snap) CreateNoCertsReissueLock() error

CreateNoCertsReissueLock is a mock implementation for the snap.Snap interface.

func (*Snap) DisableAddon

func (s *Snap) DisableAddon(_ context.Context, addon string, args ...string) error

DisableAddon is a mock implementation for the snap.Snap interface.

func (*Snap) EnableAddon

func (s *Snap) EnableAddon(_ context.Context, addon string, args ...string) error

EnableAddon is a mock implementation for the snap.Snap interface.

func (*Snap) GetCAPIPath

func (s *Snap) GetCAPIPath(parts ...string) string

GetCAPIPath is a mock implementation for the snap.Snap interface.

func (*Snap) GetGroupName

func (s *Snap) GetGroupName() string

GetGroupName is a mock implementation for the snap.Snap interface.

func (*Snap) GetKnownToken

func (s *Snap) GetKnownToken(username string) (string, error)

GetKnownToken is a mock implementation for the snap.Snap interface.

func (*Snap) GetKubeconfigFile

func (s *Snap) GetKubeconfigFile() string

GetKubeconfigFile is a mock implementation for the snap.Snap interface.

func (*Snap) GetOrCreateKubeletToken

func (s *Snap) GetOrCreateKubeletToken(hostname string) (string, error)

GetOrCreateKubeletToken is a mock implementation for the snap.Snap interface.

func (*Snap) GetOrCreateSelfCallbackToken

func (s *Snap) GetOrCreateSelfCallbackToken() (string, error)

GetOrCreateSelfCallbackToken is a mock implementation for the snap.Snap interface.

func (*Snap) GetSnapCommonPath

func (s *Snap) GetSnapCommonPath(parts ...string) string

GetSnapCommonPath is a mock implementation for the snap.Snap interface.

func (*Snap) GetSnapDataPath

func (s *Snap) GetSnapDataPath(parts ...string) string

GetSnapDataPath is a mock implementation for the snap.Snap interface.

func (*Snap) GetSnapPath

func (s *Snap) GetSnapPath(parts ...string) string

GetSnapPath is a mock implementation for the snap.Snap interface.

func (*Snap) HasDqliteLock

func (s *Snap) HasDqliteLock() bool

HasDqliteLock is a mock implementation for the snap.Snap interface.

func (*Snap) HasKubeliteLock

func (s *Snap) HasKubeliteLock() bool

HasKubeliteLock is a mock implementation for the snap.Snap interface.

func (*Snap) HasNoCertsReissueLock

func (s *Snap) HasNoCertsReissueLock() bool

HasNoCertsReissueLock is a mock implementation for the snap.Snap interface.

func (*Snap) ImportImage

func (s *Snap) ImportImage(ctx context.Context, reader io.Reader) error

ImportImage is a mock implementation for the snap.Snap interface.

func (*Snap) IsCAPIAuthTokenValid

func (s *Snap) IsCAPIAuthTokenValid(token string) (bool, error)

IsCAPIAuthTokenValid is a mock implementation for the snap.Snap interface.

func (*Snap) JoinCluster

func (s *Snap) JoinCluster(ctx context.Context, url string, worker bool) error

JoinCluster is a mock implementation for the snap.Snap interface.

func (*Snap) ReadCA

func (s *Snap) ReadCA() (string, error)

ReadCA is a mock implementation for the snap.Snap interface.

func (*Snap) ReadCAKey

func (s *Snap) ReadCAKey() (string, error)

ReadCAKey is a mock implementation for the snap.Snap interface.

func (*Snap) ReadCNIYaml

func (s *Snap) ReadCNIYaml() (string, error)

ReadCNIYaml is a mock implementation for the snap.Snap interface.

func (*Snap) ReadDqliteCert

func (s *Snap) ReadDqliteCert() (string, error)

ReadDqliteCert is a mock implementation for the snap.Snap interface.

func (*Snap) ReadDqliteClusterYaml

func (s *Snap) ReadDqliteClusterYaml() (string, error)

ReadDqliteClusterYaml is a mock implementation for the snap.Snap interface.

func (*Snap) ReadDqliteInfoYaml

func (s *Snap) ReadDqliteInfoYaml() (string, error)

ReadDqliteInfoYaml is a mock implementation for the snap.Snap interface.

func (*Snap) ReadDqliteKey

func (s *Snap) ReadDqliteKey() (string, error)

ReadDqliteKey is a mock implementation for the snap.Snap interface.

func (*Snap) ReadEtcdCertificates

func (s *Snap) ReadEtcdCertificates() (string, string, string, error)

ReadEtcdCertificates is a mock implementation for the snap.Snap interface.

func (*Snap) ReadServiceAccountKey

func (s *Snap) ReadServiceAccountKey() (string, error)

ReadServiceAccountKey is a mock implementation for the snap.Snap interface.

func (*Snap) ReadServiceArguments

func (s *Snap) ReadServiceArguments(service string) (string, error)

ReadServiceArguments is a mock implementation for the snap.Snap interface.

func (*Snap) RestartService

func (s *Snap) RestartService(_ context.Context, service string) error

RestartService is a mock implementation for the snap.Snap interface.

func (*Snap) RunCommand

func (s *Snap) RunCommand(_ context.Context, commands ...string) error

RunCommand is a mock implementation for the snap.Snap interface.

func (*Snap) RunUpgrade

func (s *Snap) RunUpgrade(ctx context.Context, upgrade string, phase string) error

RunUpgrade is a mock implementation for the snap.Snap interface.

func (*Snap) SignCertificate

func (s *Snap) SignCertificate(ctx context.Context, csrPEM []byte) ([]byte, error)

SignCertificate is a mock implementation for the snap.Snap interface.

func (*Snap) UpdateContainerdRegistryConfigs

func (s *Snap) UpdateContainerdRegistryConfigs(cfgs map[string][]byte) error

UpdateContainerdRegistryConfigs is a mock implementation for the snap.Snap interface.

func (*Snap) WriteCNIYaml

func (s *Snap) WriteCNIYaml(b []byte) error

WriteCNIYaml is a mock implementation for the snap.Snap interface.

func (*Snap) WriteCSRConfig

func (s *Snap) WriteCSRConfig(b []byte) error

WriteCSRConfig is a mock implementation for the snap.Snap interface.

func (*Snap) WriteDqliteUpdateYaml

func (s *Snap) WriteDqliteUpdateYaml(b []byte) error

WriteDqliteUpdateYaml is a mock implementation for the snap.Snap interface.

func (*Snap) WriteServiceArguments

func (s *Snap) WriteServiceArguments(service string, b []byte) error

WriteServiceArguments is a mock implementation for the snap.Snap interface.

Jump to

Keyboard shortcuts

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