mocks

package
v1.10.41 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerBuilderServiceClientMock added in v1.10.30

type ControllerBuilderServiceClientMock struct {
	// ConnectBuilderFunc mocks the ConnectBuilder method.
	ConnectBuilderFunc func(ctx context.Context, onRequest func(req *pb.BuilderRequest), response <-chan *pb.BuilderResponse) error

	// GetBuilderSystemInfoFunc mocks the GetBuilderSystemInfo method.
	GetBuilderSystemInfoFunc func(ctx context.Context) (*domain.BuilderSystemInfo, error)

	// PingBuildFunc mocks the PingBuild method.
	PingBuildFunc func(ctx context.Context, buildID string) error

	// SaveArtifactFunc mocks the SaveArtifact method.
	SaveArtifactFunc func(ctx context.Context, artifact *domain.Artifact, body []byte) error

	// SaveBuildLogFunc mocks the SaveBuildLog method.
	SaveBuildLogFunc func(ctx context.Context, buildID string, body []byte) error

	// SaveRuntimeImageFunc mocks the SaveRuntimeImage method.
	SaveRuntimeImageFunc func(ctx context.Context, buildId string, size int64) error

	// StreamBuildLogFunc mocks the StreamBuildLog method.
	StreamBuildLogFunc func(ctx context.Context, buildID string, send <-chan []byte) error
	// contains filtered or unexported fields
}

ControllerBuilderServiceClientMock is a mock implementation of domain.ControllerBuilderServiceClient.

func TestSomethingThatUsesControllerBuilderServiceClient(t *testing.T) {

	// make and configure a mocked domain.ControllerBuilderServiceClient
	mockedControllerBuilderServiceClient := &ControllerBuilderServiceClientMock{
		ConnectBuilderFunc: func(ctx context.Context, onRequest func(req *pb.BuilderRequest), response <-chan *pb.BuilderResponse) error {
			panic("mock out the ConnectBuilder method")
		},
		GetBuilderSystemInfoFunc: func(ctx context.Context) (*domain.BuilderSystemInfo, error) {
			panic("mock out the GetBuilderSystemInfo method")
		},
		PingBuildFunc: func(ctx context.Context, buildID string) error {
			panic("mock out the PingBuild method")
		},
		SaveArtifactFunc: func(ctx context.Context, artifact *domain.Artifact, body []byte) error {
			panic("mock out the SaveArtifact method")
		},
		SaveBuildLogFunc: func(ctx context.Context, buildID string, body []byte) error {
			panic("mock out the SaveBuildLog method")
		},
		SaveRuntimeImageFunc: func(ctx context.Context, buildId string, size int64) error {
			panic("mock out the SaveRuntimeImage method")
		},
		StreamBuildLogFunc: func(ctx context.Context, buildID string, send <-chan []byte) error {
			panic("mock out the StreamBuildLog method")
		},
	}

	// use mockedControllerBuilderServiceClient in code that requires domain.ControllerBuilderServiceClient
	// and then make assertions.

}

func (*ControllerBuilderServiceClientMock) ConnectBuilder added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) ConnectBuilder(ctx context.Context, onRequest func(req *pb.BuilderRequest), response <-chan *pb.BuilderResponse) error

ConnectBuilder calls ConnectBuilderFunc.

func (*ControllerBuilderServiceClientMock) ConnectBuilderCalls added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) ConnectBuilderCalls() []struct {
	Ctx       context.Context
	OnRequest func(req *pb.BuilderRequest)
	Response  <-chan *pb.BuilderResponse
}

ConnectBuilderCalls gets all the calls that were made to ConnectBuilder. Check the length with:

len(mockedControllerBuilderServiceClient.ConnectBuilderCalls())

func (*ControllerBuilderServiceClientMock) GetBuilderSystemInfo added in v1.10.30

GetBuilderSystemInfo calls GetBuilderSystemInfoFunc.

func (*ControllerBuilderServiceClientMock) GetBuilderSystemInfoCalls added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) GetBuilderSystemInfoCalls() []struct {
	Ctx context.Context
}

GetBuilderSystemInfoCalls gets all the calls that were made to GetBuilderSystemInfo. Check the length with:

len(mockedControllerBuilderServiceClient.GetBuilderSystemInfoCalls())

func (*ControllerBuilderServiceClientMock) PingBuild added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) PingBuild(ctx context.Context, buildID string) error

PingBuild calls PingBuildFunc.

func (*ControllerBuilderServiceClientMock) PingBuildCalls added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) PingBuildCalls() []struct {
	Ctx     context.Context
	BuildID string
}

PingBuildCalls gets all the calls that were made to PingBuild. Check the length with:

len(mockedControllerBuilderServiceClient.PingBuildCalls())

func (*ControllerBuilderServiceClientMock) SaveArtifact added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) SaveArtifact(ctx context.Context, artifact *domain.Artifact, body []byte) error

SaveArtifact calls SaveArtifactFunc.

func (*ControllerBuilderServiceClientMock) SaveArtifactCalls added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) SaveArtifactCalls() []struct {
	Ctx      context.Context
	Artifact *domain.Artifact
	Body     []byte
}

SaveArtifactCalls gets all the calls that were made to SaveArtifact. Check the length with:

len(mockedControllerBuilderServiceClient.SaveArtifactCalls())

func (*ControllerBuilderServiceClientMock) SaveBuildLog added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) SaveBuildLog(ctx context.Context, buildID string, body []byte) error

SaveBuildLog calls SaveBuildLogFunc.

func (*ControllerBuilderServiceClientMock) SaveBuildLogCalls added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) SaveBuildLogCalls() []struct {
	Ctx     context.Context
	BuildID string
	Body    []byte
}

SaveBuildLogCalls gets all the calls that were made to SaveBuildLog. Check the length with:

len(mockedControllerBuilderServiceClient.SaveBuildLogCalls())

func (*ControllerBuilderServiceClientMock) SaveRuntimeImage added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) SaveRuntimeImage(ctx context.Context, buildId string, size int64) error

SaveRuntimeImage calls SaveRuntimeImageFunc.

func (*ControllerBuilderServiceClientMock) SaveRuntimeImageCalls added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) SaveRuntimeImageCalls() []struct {
	Ctx     context.Context
	BuildId string
	Size    int64
}

SaveRuntimeImageCalls gets all the calls that were made to SaveRuntimeImage. Check the length with:

len(mockedControllerBuilderServiceClient.SaveRuntimeImageCalls())

func (*ControllerBuilderServiceClientMock) StreamBuildLog added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) StreamBuildLog(ctx context.Context, buildID string, send <-chan []byte) error

StreamBuildLog calls StreamBuildLogFunc.

func (*ControllerBuilderServiceClientMock) StreamBuildLogCalls added in v1.10.30

func (mock *ControllerBuilderServiceClientMock) StreamBuildLogCalls() []struct {
	Ctx     context.Context
	BuildID string
	Send    <-chan []byte
}

StreamBuildLogCalls gets all the calls that were made to StreamBuildLog. Check the length with:

len(mockedControllerBuilderServiceClient.StreamBuildLogCalls())

type ControllerServiceClientMock

type ControllerServiceClientMock struct {
	// CancelBuildFunc mocks the CancelBuild method.
	CancelBuildFunc func(ctx context.Context, buildID string) error

	// CancelBuildLocalFunc mocks the CancelBuildLocal method.
	CancelBuildLocalFunc func(ctx context.Context, buildID string) error

	// DiscoverBuildLogInstanceFunc mocks the DiscoverBuildLogInstance method.
	DiscoverBuildLogInstanceFunc func(ctx context.Context, buildID string) (*pb.AddressInfo, error)

	// DiscoverBuildLogLocalFunc mocks the DiscoverBuildLogLocal method.
	DiscoverBuildLogLocalFunc func(ctx context.Context, buildID string) (*pb.AddressInfo, error)

	// FetchRepositoryFunc mocks the FetchRepository method.
	FetchRepositoryFunc func(ctx context.Context, repositoryID string) error

	// GetSystemInfoFunc mocks the GetSystemInfo method.
	GetSystemInfoFunc func(ctx context.Context) (*domain.SystemInfo, error)

	// RegisterBuildFunc mocks the RegisterBuild method.
	RegisterBuildFunc func(ctx context.Context, appID string) error

	// StartBuildFunc mocks the StartBuild method.
	StartBuildFunc func(ctx context.Context) error

	// StartBuildLocalFunc mocks the StartBuildLocal method.
	StartBuildLocalFunc func(ctx context.Context) error

	// StreamBuildLogFunc mocks the StreamBuildLog method.
	StreamBuildLogFunc func(ctx context.Context, address string, buildID string) (<-chan *pb.BuildLog, error)

	// SyncDeploymentsFunc mocks the SyncDeployments method.
	SyncDeploymentsFunc func(ctx context.Context) error

	// SyncDeploymentsLocalFunc mocks the SyncDeploymentsLocal method.
	SyncDeploymentsLocalFunc func(ctx context.Context) error
	// contains filtered or unexported fields
}

ControllerServiceClientMock is a mock implementation of domain.ControllerServiceClient.

func TestSomethingThatUsesControllerServiceClient(t *testing.T) {

	// make and configure a mocked domain.ControllerServiceClient
	mockedControllerServiceClient := &ControllerServiceClientMock{
		CancelBuildFunc: func(ctx context.Context, buildID string) error {
			panic("mock out the CancelBuild method")
		},
		CancelBuildLocalFunc: func(ctx context.Context, buildID string) error {
			panic("mock out the CancelBuildLocal method")
		},
		DiscoverBuildLogInstanceFunc: func(ctx context.Context, buildID string) (*pb.AddressInfo, error) {
			panic("mock out the DiscoverBuildLogInstance method")
		},
		DiscoverBuildLogLocalFunc: func(ctx context.Context, buildID string) (*pb.AddressInfo, error) {
			panic("mock out the DiscoverBuildLogLocal method")
		},
		FetchRepositoryFunc: func(ctx context.Context, repositoryID string) error {
			panic("mock out the FetchRepository method")
		},
		GetSystemInfoFunc: func(ctx context.Context) (*domain.SystemInfo, error) {
			panic("mock out the GetSystemInfo method")
		},
		RegisterBuildFunc: func(ctx context.Context, appID string) error {
			panic("mock out the RegisterBuild method")
		},
		StartBuildFunc: func(ctx context.Context) error {
			panic("mock out the StartBuild method")
		},
		StartBuildLocalFunc: func(ctx context.Context) error {
			panic("mock out the StartBuildLocal method")
		},
		StreamBuildLogFunc: func(ctx context.Context, address string, buildID string) (<-chan *pb.BuildLog, error) {
			panic("mock out the StreamBuildLog method")
		},
		SyncDeploymentsFunc: func(ctx context.Context) error {
			panic("mock out the SyncDeployments method")
		},
		SyncDeploymentsLocalFunc: func(ctx context.Context) error {
			panic("mock out the SyncDeploymentsLocal method")
		},
	}

	// use mockedControllerServiceClient in code that requires domain.ControllerServiceClient
	// and then make assertions.

}

func (*ControllerServiceClientMock) CancelBuild

func (mock *ControllerServiceClientMock) CancelBuild(ctx context.Context, buildID string) error

CancelBuild calls CancelBuildFunc.

func (*ControllerServiceClientMock) CancelBuildCalls

func (mock *ControllerServiceClientMock) CancelBuildCalls() []struct {
	Ctx     context.Context
	BuildID string
}

CancelBuildCalls gets all the calls that were made to CancelBuild. Check the length with:

len(mockedControllerServiceClient.CancelBuildCalls())

func (*ControllerServiceClientMock) CancelBuildLocal

func (mock *ControllerServiceClientMock) CancelBuildLocal(ctx context.Context, buildID string) error

CancelBuildLocal calls CancelBuildLocalFunc.

func (*ControllerServiceClientMock) CancelBuildLocalCalls

func (mock *ControllerServiceClientMock) CancelBuildLocalCalls() []struct {
	Ctx     context.Context
	BuildID string
}

CancelBuildLocalCalls gets all the calls that were made to CancelBuildLocal. Check the length with:

len(mockedControllerServiceClient.CancelBuildLocalCalls())

func (*ControllerServiceClientMock) DiscoverBuildLogInstance

func (mock *ControllerServiceClientMock) DiscoverBuildLogInstance(ctx context.Context, buildID string) (*pb.AddressInfo, error)

DiscoverBuildLogInstance calls DiscoverBuildLogInstanceFunc.

func (*ControllerServiceClientMock) DiscoverBuildLogInstanceCalls

func (mock *ControllerServiceClientMock) DiscoverBuildLogInstanceCalls() []struct {
	Ctx     context.Context
	BuildID string
}

DiscoverBuildLogInstanceCalls gets all the calls that were made to DiscoverBuildLogInstance. Check the length with:

len(mockedControllerServiceClient.DiscoverBuildLogInstanceCalls())

func (*ControllerServiceClientMock) DiscoverBuildLogLocal

func (mock *ControllerServiceClientMock) DiscoverBuildLogLocal(ctx context.Context, buildID string) (*pb.AddressInfo, error)

DiscoverBuildLogLocal calls DiscoverBuildLogLocalFunc.

func (*ControllerServiceClientMock) DiscoverBuildLogLocalCalls

func (mock *ControllerServiceClientMock) DiscoverBuildLogLocalCalls() []struct {
	Ctx     context.Context
	BuildID string
}

DiscoverBuildLogLocalCalls gets all the calls that were made to DiscoverBuildLogLocal. Check the length with:

len(mockedControllerServiceClient.DiscoverBuildLogLocalCalls())

func (*ControllerServiceClientMock) FetchRepository

func (mock *ControllerServiceClientMock) FetchRepository(ctx context.Context, repositoryID string) error

FetchRepository calls FetchRepositoryFunc.

func (*ControllerServiceClientMock) FetchRepositoryCalls

func (mock *ControllerServiceClientMock) FetchRepositoryCalls() []struct {
	Ctx          context.Context
	RepositoryID string
}

FetchRepositoryCalls gets all the calls that were made to FetchRepository. Check the length with:

len(mockedControllerServiceClient.FetchRepositoryCalls())

func (*ControllerServiceClientMock) GetSystemInfo

func (mock *ControllerServiceClientMock) GetSystemInfo(ctx context.Context) (*domain.SystemInfo, error)

GetSystemInfo calls GetSystemInfoFunc.

func (*ControllerServiceClientMock) GetSystemInfoCalls

func (mock *ControllerServiceClientMock) GetSystemInfoCalls() []struct {
	Ctx context.Context
}

GetSystemInfoCalls gets all the calls that were made to GetSystemInfo. Check the length with:

len(mockedControllerServiceClient.GetSystemInfoCalls())

func (*ControllerServiceClientMock) RegisterBuild

func (mock *ControllerServiceClientMock) RegisterBuild(ctx context.Context, appID string) error

RegisterBuild calls RegisterBuildFunc.

func (*ControllerServiceClientMock) RegisterBuildCalls

func (mock *ControllerServiceClientMock) RegisterBuildCalls() []struct {
	Ctx   context.Context
	AppID string
}

RegisterBuildCalls gets all the calls that were made to RegisterBuild. Check the length with:

len(mockedControllerServiceClient.RegisterBuildCalls())

func (*ControllerServiceClientMock) StartBuild

func (mock *ControllerServiceClientMock) StartBuild(ctx context.Context) error

StartBuild calls StartBuildFunc.

func (*ControllerServiceClientMock) StartBuildCalls

func (mock *ControllerServiceClientMock) StartBuildCalls() []struct {
	Ctx context.Context
}

StartBuildCalls gets all the calls that were made to StartBuild. Check the length with:

len(mockedControllerServiceClient.StartBuildCalls())

func (*ControllerServiceClientMock) StartBuildLocal

func (mock *ControllerServiceClientMock) StartBuildLocal(ctx context.Context) error

StartBuildLocal calls StartBuildLocalFunc.

func (*ControllerServiceClientMock) StartBuildLocalCalls

func (mock *ControllerServiceClientMock) StartBuildLocalCalls() []struct {
	Ctx context.Context
}

StartBuildLocalCalls gets all the calls that were made to StartBuildLocal. Check the length with:

len(mockedControllerServiceClient.StartBuildLocalCalls())

func (*ControllerServiceClientMock) StreamBuildLog

func (mock *ControllerServiceClientMock) StreamBuildLog(ctx context.Context, address string, buildID string) (<-chan *pb.BuildLog, error)

StreamBuildLog calls StreamBuildLogFunc.

func (*ControllerServiceClientMock) StreamBuildLogCalls

func (mock *ControllerServiceClientMock) StreamBuildLogCalls() []struct {
	Ctx     context.Context
	Address string
	BuildID string
}

StreamBuildLogCalls gets all the calls that were made to StreamBuildLog. Check the length with:

len(mockedControllerServiceClient.StreamBuildLogCalls())

func (*ControllerServiceClientMock) SyncDeployments

func (mock *ControllerServiceClientMock) SyncDeployments(ctx context.Context) error

SyncDeployments calls SyncDeploymentsFunc.

func (*ControllerServiceClientMock) SyncDeploymentsCalls

func (mock *ControllerServiceClientMock) SyncDeploymentsCalls() []struct {
	Ctx context.Context
}

SyncDeploymentsCalls gets all the calls that were made to SyncDeployments. Check the length with:

len(mockedControllerServiceClient.SyncDeploymentsCalls())

func (*ControllerServiceClientMock) SyncDeploymentsLocal

func (mock *ControllerServiceClientMock) SyncDeploymentsLocal(ctx context.Context) error

SyncDeploymentsLocal calls SyncDeploymentsLocalFunc.

func (*ControllerServiceClientMock) SyncDeploymentsLocalCalls

func (mock *ControllerServiceClientMock) SyncDeploymentsLocalCalls() []struct {
	Ctx context.Context
}

SyncDeploymentsLocalCalls gets all the calls that were made to SyncDeploymentsLocal. Check the length with:

len(mockedControllerServiceClient.SyncDeploymentsLocalCalls())

type GitRepositoryMock

type GitRepositoryMock struct {
	// FetchFunc mocks the Fetch method.
	FetchFunc func(ctx context.Context, hashes []string) error

	// GetCommitFunc mocks the GetCommit method.
	GetCommitFunc func(hash string) (*domain.RepositoryCommit, error)
	// contains filtered or unexported fields
}

GitRepositoryMock is a mock implementation of domain.GitRepository.

func TestSomethingThatUsesGitRepository(t *testing.T) {

	// make and configure a mocked domain.GitRepository
	mockedGitRepository := &GitRepositoryMock{
		FetchFunc: func(ctx context.Context, hashes []string) error {
			panic("mock out the Fetch method")
		},
		GetCommitFunc: func(hash string) (*domain.RepositoryCommit, error) {
			panic("mock out the GetCommit method")
		},
	}

	// use mockedGitRepository in code that requires domain.GitRepository
	// and then make assertions.

}

func (*GitRepositoryMock) Fetch

func (mock *GitRepositoryMock) Fetch(ctx context.Context, hashes []string) error

Fetch calls FetchFunc.

func (*GitRepositoryMock) FetchCalls

func (mock *GitRepositoryMock) FetchCalls() []struct {
	Ctx    context.Context
	Hashes []string
}

FetchCalls gets all the calls that were made to Fetch. Check the length with:

len(mockedGitRepository.FetchCalls())

func (*GitRepositoryMock) GetCommit

func (mock *GitRepositoryMock) GetCommit(hash string) (*domain.RepositoryCommit, error)

GetCommit calls GetCommitFunc.

func (*GitRepositoryMock) GetCommitCalls

func (mock *GitRepositoryMock) GetCommitCalls() []struct {
	Hash string
}

GetCommitCalls gets all the calls that were made to GetCommit. Check the length with:

len(mockedGitRepository.GetCommitCalls())

type GitServiceMock

type GitServiceMock struct {
	// CloneRepositoryFunc mocks the CloneRepository method.
	CloneRepositoryFunc func(ctx context.Context, dir string, repo *domain.Repository, commitHash string) error

	// CreateBareRepositoryFunc mocks the CreateBareRepository method.
	CreateBareRepositoryFunc func(dir string, repo *domain.Repository) (domain.GitRepository, error)

	// ResolveRefsFunc mocks the ResolveRefs method.
	ResolveRefsFunc func(ctx context.Context, repo *domain.Repository) (map[string]string, error)
	// contains filtered or unexported fields
}

GitServiceMock is a mock implementation of domain.GitService.

func TestSomethingThatUsesGitService(t *testing.T) {

	// make and configure a mocked domain.GitService
	mockedGitService := &GitServiceMock{
		CloneRepositoryFunc: func(ctx context.Context, dir string, repo *domain.Repository, commitHash string) error {
			panic("mock out the CloneRepository method")
		},
		CreateBareRepositoryFunc: func(dir string, repo *domain.Repository) (domain.GitRepository, error) {
			panic("mock out the CreateBareRepository method")
		},
		ResolveRefsFunc: func(ctx context.Context, repo *domain.Repository) (map[string]string, error) {
			panic("mock out the ResolveRefs method")
		},
	}

	// use mockedGitService in code that requires domain.GitService
	// and then make assertions.

}

func (*GitServiceMock) CloneRepository

func (mock *GitServiceMock) CloneRepository(ctx context.Context, dir string, repo *domain.Repository, commitHash string) error

CloneRepository calls CloneRepositoryFunc.

func (*GitServiceMock) CloneRepositoryCalls

func (mock *GitServiceMock) CloneRepositoryCalls() []struct {
	Ctx        context.Context
	Dir        string
	Repo       *domain.Repository
	CommitHash string
}

CloneRepositoryCalls gets all the calls that were made to CloneRepository. Check the length with:

len(mockedGitService.CloneRepositoryCalls())

func (*GitServiceMock) CreateBareRepository

func (mock *GitServiceMock) CreateBareRepository(dir string, repo *domain.Repository) (domain.GitRepository, error)

CreateBareRepository calls CreateBareRepositoryFunc.

func (*GitServiceMock) CreateBareRepositoryCalls

func (mock *GitServiceMock) CreateBareRepositoryCalls() []struct {
	Dir  string
	Repo *domain.Repository
}

CreateBareRepositoryCalls gets all the calls that were made to CreateBareRepository. Check the length with:

len(mockedGitService.CreateBareRepositoryCalls())

func (*GitServiceMock) ResolveRefs

func (mock *GitServiceMock) ResolveRefs(ctx context.Context, repo *domain.Repository) (map[string]string, error)

ResolveRefs calls ResolveRefsFunc.

func (*GitServiceMock) ResolveRefsCalls

func (mock *GitServiceMock) ResolveRefsCalls() []struct {
	Ctx  context.Context
	Repo *domain.Repository
}

ResolveRefsCalls gets all the calls that were made to ResolveRefs. Check the length with:

len(mockedGitService.ResolveRefsCalls())

type MariaDBManagerMock

type MariaDBManagerMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error

	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, args domain.CreateArgs) error

	// DeleteFunc mocks the Delete method.
	DeleteFunc func(ctx context.Context, args domain.DeleteArgs) error

	// GetHostFunc mocks the GetHost method.
	GetHostFunc func() (string, int)

	// IsExistFunc mocks the IsExist method.
	IsExistFunc func(ctx context.Context, dbname string) (bool, error)
	// contains filtered or unexported fields
}

MariaDBManagerMock is a mock implementation of domain.MariaDBManager.

func TestSomethingThatUsesMariaDBManager(t *testing.T) {

	// make and configure a mocked domain.MariaDBManager
	mockedMariaDBManager := &MariaDBManagerMock{
		CloseFunc: func(ctx context.Context) error {
			panic("mock out the Close method")
		},
		CreateFunc: func(ctx context.Context, args domain.CreateArgs) error {
			panic("mock out the Create method")
		},
		DeleteFunc: func(ctx context.Context, args domain.DeleteArgs) error {
			panic("mock out the Delete method")
		},
		GetHostFunc: func() (string, int) {
			panic("mock out the GetHost method")
		},
		IsExistFunc: func(ctx context.Context, dbname string) (bool, error) {
			panic("mock out the IsExist method")
		},
	}

	// use mockedMariaDBManager in code that requires domain.MariaDBManager
	// and then make assertions.

}

func (*MariaDBManagerMock) Close

func (mock *MariaDBManagerMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*MariaDBManagerMock) CloseCalls

func (mock *MariaDBManagerMock) CloseCalls() []struct {
	Ctx context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedMariaDBManager.CloseCalls())

func (*MariaDBManagerMock) Create

func (mock *MariaDBManagerMock) Create(ctx context.Context, args domain.CreateArgs) error

Create calls CreateFunc.

func (*MariaDBManagerMock) CreateCalls

func (mock *MariaDBManagerMock) CreateCalls() []struct {
	Ctx  context.Context
	Args domain.CreateArgs
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedMariaDBManager.CreateCalls())

func (*MariaDBManagerMock) Delete

func (mock *MariaDBManagerMock) Delete(ctx context.Context, args domain.DeleteArgs) error

Delete calls DeleteFunc.

func (*MariaDBManagerMock) DeleteCalls

func (mock *MariaDBManagerMock) DeleteCalls() []struct {
	Ctx  context.Context
	Args domain.DeleteArgs
}

DeleteCalls gets all the calls that were made to Delete. Check the length with:

len(mockedMariaDBManager.DeleteCalls())

func (*MariaDBManagerMock) GetHost

func (mock *MariaDBManagerMock) GetHost() (string, int)

GetHost calls GetHostFunc.

func (*MariaDBManagerMock) GetHostCalls

func (mock *MariaDBManagerMock) GetHostCalls() []struct {
}

GetHostCalls gets all the calls that were made to GetHost. Check the length with:

len(mockedMariaDBManager.GetHostCalls())

func (*MariaDBManagerMock) IsExist

func (mock *MariaDBManagerMock) IsExist(ctx context.Context, dbname string) (bool, error)

IsExist calls IsExistFunc.

func (*MariaDBManagerMock) IsExistCalls

func (mock *MariaDBManagerMock) IsExistCalls() []struct {
	Ctx    context.Context
	Dbname string
}

IsExistCalls gets all the calls that were made to IsExist. Check the length with:

len(mockedMariaDBManager.IsExistCalls())

type MongoDBManagerMock

type MongoDBManagerMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error

	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, args domain.CreateArgs) error

	// DeleteFunc mocks the Delete method.
	DeleteFunc func(ctx context.Context, args domain.DeleteArgs) error

	// GetHostFunc mocks the GetHost method.
	GetHostFunc func() (string, int)

	// IsExistFunc mocks the IsExist method.
	IsExistFunc func(ctx context.Context, dbname string) (bool, error)
	// contains filtered or unexported fields
}

MongoDBManagerMock is a mock implementation of domain.MongoDBManager.

func TestSomethingThatUsesMongoDBManager(t *testing.T) {

	// make and configure a mocked domain.MongoDBManager
	mockedMongoDBManager := &MongoDBManagerMock{
		CloseFunc: func(ctx context.Context) error {
			panic("mock out the Close method")
		},
		CreateFunc: func(ctx context.Context, args domain.CreateArgs) error {
			panic("mock out the Create method")
		},
		DeleteFunc: func(ctx context.Context, args domain.DeleteArgs) error {
			panic("mock out the Delete method")
		},
		GetHostFunc: func() (string, int) {
			panic("mock out the GetHost method")
		},
		IsExistFunc: func(ctx context.Context, dbname string) (bool, error) {
			panic("mock out the IsExist method")
		},
	}

	// use mockedMongoDBManager in code that requires domain.MongoDBManager
	// and then make assertions.

}

func (*MongoDBManagerMock) Close

func (mock *MongoDBManagerMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*MongoDBManagerMock) CloseCalls

func (mock *MongoDBManagerMock) CloseCalls() []struct {
	Ctx context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedMongoDBManager.CloseCalls())

func (*MongoDBManagerMock) Create

func (mock *MongoDBManagerMock) Create(ctx context.Context, args domain.CreateArgs) error

Create calls CreateFunc.

func (*MongoDBManagerMock) CreateCalls

func (mock *MongoDBManagerMock) CreateCalls() []struct {
	Ctx  context.Context
	Args domain.CreateArgs
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedMongoDBManager.CreateCalls())

func (*MongoDBManagerMock) Delete

func (mock *MongoDBManagerMock) Delete(ctx context.Context, args domain.DeleteArgs) error

Delete calls DeleteFunc.

func (*MongoDBManagerMock) DeleteCalls

func (mock *MongoDBManagerMock) DeleteCalls() []struct {
	Ctx  context.Context
	Args domain.DeleteArgs
}

DeleteCalls gets all the calls that were made to Delete. Check the length with:

len(mockedMongoDBManager.DeleteCalls())

func (*MongoDBManagerMock) GetHost

func (mock *MongoDBManagerMock) GetHost() (string, int)

GetHost calls GetHostFunc.

func (*MongoDBManagerMock) GetHostCalls

func (mock *MongoDBManagerMock) GetHostCalls() []struct {
}

GetHostCalls gets all the calls that were made to GetHost. Check the length with:

len(mockedMongoDBManager.GetHostCalls())

func (*MongoDBManagerMock) IsExist

func (mock *MongoDBManagerMock) IsExist(ctx context.Context, dbname string) (bool, error)

IsExist calls IsExistFunc.

func (*MongoDBManagerMock) IsExistCalls

func (mock *MongoDBManagerMock) IsExistCalls() []struct {
	Ctx    context.Context
	Dbname string
}

IsExistCalls gets all the calls that were made to IsExist. Check the length with:

len(mockedMongoDBManager.IsExistCalls())

type RegistryClientMock

type RegistryClientMock struct {
	// DeleteImageFunc mocks the DeleteImage method.
	DeleteImageFunc func(ctx context.Context, image string, tag string) error

	// GetImageSizeFunc mocks the GetImageSize method.
	GetImageSizeFunc func(ctx context.Context, image string, tag string) (int64, error)

	// GetTagsFunc mocks the GetTags method.
	GetTagsFunc func(ctx context.Context, image string) ([]string, error)
	// contains filtered or unexported fields
}

RegistryClientMock is a mock implementation of builder.RegistryClient.

func TestSomethingThatUsesRegistryClient(t *testing.T) {

	// make and configure a mocked builder.RegistryClient
	mockedRegistryClient := &RegistryClientMock{
		DeleteImageFunc: func(ctx context.Context, image string, tag string) error {
			panic("mock out the DeleteImage method")
		},
		GetImageSizeFunc: func(ctx context.Context, image string, tag string) (int64, error) {
			panic("mock out the GetImageSize method")
		},
		GetTagsFunc: func(ctx context.Context, image string) ([]string, error) {
			panic("mock out the GetTags method")
		},
	}

	// use mockedRegistryClient in code that requires builder.RegistryClient
	// and then make assertions.

}

func (*RegistryClientMock) DeleteImage

func (mock *RegistryClientMock) DeleteImage(ctx context.Context, image string, tag string) error

DeleteImage calls DeleteImageFunc.

func (*RegistryClientMock) DeleteImageCalls

func (mock *RegistryClientMock) DeleteImageCalls() []struct {
	Ctx   context.Context
	Image string
	Tag   string
}

DeleteImageCalls gets all the calls that were made to DeleteImage. Check the length with:

len(mockedRegistryClient.DeleteImageCalls())

func (*RegistryClientMock) GetImageSize

func (mock *RegistryClientMock) GetImageSize(ctx context.Context, image string, tag string) (int64, error)

GetImageSize calls GetImageSizeFunc.

func (*RegistryClientMock) GetImageSizeCalls

func (mock *RegistryClientMock) GetImageSizeCalls() []struct {
	Ctx   context.Context
	Image string
	Tag   string
}

GetImageSizeCalls gets all the calls that were made to GetImageSize. Check the length with:

len(mockedRegistryClient.GetImageSizeCalls())

func (*RegistryClientMock) GetTags

func (mock *RegistryClientMock) GetTags(ctx context.Context, image string) ([]string, error)

GetTags calls GetTagsFunc.

func (*RegistryClientMock) GetTagsCalls

func (mock *RegistryClientMock) GetTagsCalls() []struct {
	Ctx   context.Context
	Image string
}

GetTagsCalls gets all the calls that were made to GetTags. Check the length with:

len(mockedRegistryClient.GetTagsCalls())

Jump to

Keyboard shortcuts

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