test

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetBalCurrentDir

func SetBalCurrentDir(currentDir string) func(*MockBalExecutor)

func SetBalExecutor

func SetBalExecutor(balExecutor ballerina.BalExecutor) func(*MockCli)

func SetBalVersion

func SetBalVersion(version string) func(*MockBalExecutor)

func SetCelleryInstallationDir

func SetCelleryInstallationDir(dir string) func(*MockFileSystem)

func SetClientVersion

func SetClientVersion(version string) func(*MockDockerCli)

SetClientVersion sets client version of mock docker cli.

func SetCredManager

func SetCredManager(manager credentials.CredManager) func(*MockCli)

func SetCredentials

func SetCredentials(registry, userName, password string) func(*MockCredManager)

func SetCurrentDir

func SetCurrentDir(currentDir string) func(*MockFileSystem)

func SetDockerCli

func SetDockerCli(docker docker.Docker) func(*MockCli)

func SetFileSystem

func SetFileSystem(manager cli.FileSystemManager) func(*MockCli)

func SetImages

func SetImages(images map[string][]byte) func(*MockRegistry)

func SetK8sVersions

func SetK8sVersions(serverVersion, clientVersion string) func(*MockKubeCli)

func SetKubeCli

func SetKubeCli(kubecli kubernetes.KubeCli) func(*MockCli)

func SetMetadataJsonContent

func SetMetadataJsonContent(content []byte) func(*MockBalExecutor)

func SetRegistry

func SetRegistry(registry registry.Registry) func(*MockCli)

func SetRepository

func SetRepository(repository string) func(*MockFileSystem)

func SetServerVersion

func SetServerVersion(version string) func(*MockDockerCli)

SetServerVersion sets server version of mock docker cli.

func SetYamlContent

func SetYamlContent(content []byte) func(*MockBalExecutor)

func SetYamlName

func SetYamlName(name string) func(*MockBalExecutor)

func WithCellLogs

func WithCellLogs(cellLogs map[string]string) func(*MockKubeCli)

func WithCells

func WithCells(cells kubernetes.Cells) func(*MockKubeCli)

func WithCellsAsBytes

func WithCellsAsBytes(cellsBytes map[string][]byte) func(*MockKubeCli)

func WithComponentLogs

func WithComponentLogs(componentLogs map[string]string) func(*MockKubeCli)

func WithComposites

func WithComposites(composites kubernetes.Composites) func(*MockKubeCli)

func WithServices

func WithServices(services map[string]kubernetes.Services) func(*MockKubeCli)

Types

type MockBalExecutor

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

func NewMockBalExecutor

func NewMockBalExecutor(opts ...func(*MockBalExecutor)) *MockBalExecutor

NewMockBalExecutor returns a MockBalExecutor instance.

func (*MockBalExecutor) Build

func (balExecutor *MockBalExecutor) Build(fileName string, args []string) error

Build mocks execution of ballerina build on an executable bal file.

func (*MockBalExecutor) ExecutablePath

func (balExecutor *MockBalExecutor) ExecutablePath() (string, error)

ExecutablePath returns mock ballerina executable path.

func (*MockBalExecutor) Init

func (balExecutor *MockBalExecutor) Init(projectName string) error

Build mocks execution of ballerina run for cellery init on an executable bal file.

func (*MockBalExecutor) Run

func (balExecutor *MockBalExecutor) Run(fileName string, args []string, envVars []*ballerina.EnvironmentVariable) error

Build mocks execution of ballerina run on an executable bal file.

func (*MockBalExecutor) Test

func (balExecutor *MockBalExecutor) Test(fileName string, args []string, envVars []*ballerina.EnvironmentVariable) error

Build mocks execution of ballerina run for tests on an executable bal file.

func (*MockBalExecutor) Version

func (balExecutor *MockBalExecutor) Version() (string, error)

Version returns the mock ballerina version.

type MockCli

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

func NewMockCli

func NewMockCli(opts ...func(*MockCli)) *MockCli

NewMockCli returns a mock cli for the cli.Cli interface.

func (*MockCli) BalExecutor

func (cli *MockCli) BalExecutor() ballerina.BalExecutor

BalExecutor returns a mock ballerina.BalExecutor instance.

func (*MockCli) CredManager

func (cli *MockCli) CredManager() credentials.CredManager

CredManager returns a mock CredManager instance.

func (*MockCli) DockerCli

func (cli *MockCli) DockerCli() docker.Docker

FileSystem returns mock DockerCli instance.

func (*MockCli) ExecuteTask

func (cli *MockCli) ExecuteTask(startMessage, errorMessage, successMessage string, function func() error) error

ExecuteTask mocks function execution.

func (*MockCli) FileSystem

func (cli *MockCli) FileSystem() cli.FileSystemManager

FileSystem returns a mock FileSystemManager instance.

func (*MockCli) KubeCli

func (cli *MockCli) KubeCli() kubernetes.KubeCli

KubeCli returns mock kubernetes.KubeCli instance.

func (*MockCli) OpenBrowser

func (cli *MockCli) OpenBrowser(url string) error

OpenBrowser mocks opening up of the provided URL in a browser

func (*MockCli) Out

func (cli *MockCli) Out() io.Writer

Out returns the output stream (stdout) the cli should write on.

func (*MockCli) OutBuffer

func (cli *MockCli) OutBuffer() *bytes.Buffer

OutBuffer returns the stdout buffer.

func (*MockCli) Registry

func (cli *MockCli) Registry() registry.Registry

KubeCli returns kubernetes.KubeCli instance.

type MockCredManager

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

func NewMockCredManager

func NewMockCredManager(opts ...func(*MockCredManager)) *MockCredManager

func (MockCredManager) GetCredentials

func (credManager MockCredManager) GetCredentials(registry string) (*credentials.RegistryCredentials, error)

GetCredentials retrieves the mock credentials from the credentials file.

func (MockCredManager) HasCredentials

func (credManager MockCredManager) HasCredentials(registry string) (bool, error)

IsRegistryPresent checks if the registry credentials exists in the credentials file.

func (MockCredManager) RemoveCredentials

func (credManager MockCredManager) RemoveCredentials(registry string) error

RemoveCredentials mocks removal of the stored credentials from the credentials file.

func (MockCredManager) StoreCredentials

func (credManager MockCredManager) StoreCredentials(credentials *credentials.RegistryCredentials) error

StoreCredentials stores the mock credentials in credentials file.

type MockDockerCli

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

func NewMockDockerCli

func NewMockDockerCli(opts ...func(*MockDockerCli)) *MockDockerCli

NewMockDockerCli returns a MockDockerCli instance.

func (*MockDockerCli) ClientVersion

func (cli *MockDockerCli) ClientVersion() (string, error)

ClientVersion returns the docker client version.

func (*MockDockerCli) PushImages

func (cli *MockDockerCli) PushImages(dockerImages []string) error

PushImages pushes docker images.

func (*MockDockerCli) ServerVersion

func (cli *MockDockerCli) ServerVersion() (string, error)

ServerVersion returns the docker server version.

type MockFileSystem

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

func NewMockFileSystem

func NewMockFileSystem(opts ...func(*MockFileSystem)) *MockFileSystem

NewMockFileSystem returns a mockFileSystem instance.

func (*MockFileSystem) CelleryInstallationDir

func (fs *MockFileSystem) CelleryInstallationDir() string

func (*MockFileSystem) CurrentDir

func (fs *MockFileSystem) CurrentDir() string

CurrentDir returns the current directory.

func (*MockFileSystem) Repository

func (fs *MockFileSystem) Repository() string

UserHome returns user home.

func (*MockFileSystem) TempDir

func (fs *MockFileSystem) TempDir() string

TempDir returns the temp directory.

func (*MockFileSystem) UserHome

func (fs *MockFileSystem) UserHome() string

UserHome returns the user home.

func (*MockFileSystem) WorkingDirRelativePath

func (fs *MockFileSystem) WorkingDirRelativePath() string

WorkingDirRelativePath returns the relative path of working directory. For mock file system, WorkingDirRelativePath is also the current dir path.

type MockKubeCli

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

func NewMockKubeCli

func NewMockKubeCli(opts ...func(*MockKubeCli)) *MockKubeCli

NewMockKubeCli returns a mock cli for the cli.KubeCli interface.

func (*MockKubeCli) ApplyFile

func (kubeCli *MockKubeCli) ApplyFile(file string) error

func (*MockKubeCli) DeleteResource

func (kubeCli *MockKubeCli) DeleteResource(kind, instance string) (string, error)

func (*MockKubeCli) DescribeCell

func (kubeCli *MockKubeCli) DescribeCell(cellName string) error

func (*MockKubeCli) GetCell

func (kubeCli *MockKubeCli) GetCell(cellName string) (kubernetes.Cell, error)

func (*MockKubeCli) GetCellInstanceAsMapInterface

func (kubeCli *MockKubeCli) GetCellInstanceAsMapInterface(cell string) (map[string]interface{}, error)

func (*MockKubeCli) GetCellLogsAllComponents

func (kubeCli *MockKubeCli) GetCellLogsAllComponents(cellName string) (string, error)

func (*MockKubeCli) GetCellLogsUserComponents

func (kubeCli *MockKubeCli) GetCellLogsUserComponents(cellName string) (string, error)

func (*MockKubeCli) GetCells

func (kubeCli *MockKubeCli) GetCells() ([]kubernetes.Cell, error)

GetCells returns cell instances array.

func (*MockKubeCli) GetComponentLogs

func (kubeCli *MockKubeCli) GetComponentLogs(cellName, componentName string) (string, error)

func (*MockKubeCli) GetComposite

func (kubeCli *MockKubeCli) GetComposite(compositeName string) (kubernetes.Composite, error)

func (*MockKubeCli) GetCompositeInstanceAsMapInterface

func (kubeCli *MockKubeCli) GetCompositeInstanceAsMapInterface(composite string) (map[string]interface{}, error)

func (*MockKubeCli) GetComposites

func (kubeCli *MockKubeCli) GetComposites() ([]kubernetes.Composite, error)

func (*MockKubeCli) GetInstanceBytes

func (kubeCli *MockKubeCli) GetInstanceBytes(instanceKind, InstanceName string) ([]byte, error)

func (*MockKubeCli) GetInstancesNames

func (kubeCli *MockKubeCli) GetInstancesNames() ([]string, error)

func (*MockKubeCli) GetPodsForCell

func (kubeCli *MockKubeCli) GetPodsForCell(cellName string) (kubernetes.Pods, error)

func (*MockKubeCli) GetPodsForComposite

func (kubeCli *MockKubeCli) GetPodsForComposite(compName string) (kubernetes.Pods, error)

func (*MockKubeCli) GetServices

func (kubeCli *MockKubeCli) GetServices(cellName string) (kubernetes.Services, error)

func (*MockKubeCli) JsonPatch

func (kubeCli *MockKubeCli) JsonPatch(kind, instance, jsonPatch string) error

func (*MockKubeCli) SetVerboseMode

func (kubeCli *MockKubeCli) SetVerboseMode(enable bool)

func (*MockKubeCli) Version

func (kubeCli *MockKubeCli) Version() (string, string, error)

type MockRegistry

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

func NewMockRegistry

func NewMockRegistry(opts ...func(*MockRegistry)) *MockRegistry

func (*MockRegistry) Out

func (registry *MockRegistry) Out() io.Writer

Out returns the mock writer used for the stdout.

func (*MockRegistry) Pull

func (registry *MockRegistry) Pull(parsedCellImage *image.CellImage, username string, password string) ([]byte, error)

func (*MockRegistry) Push

func (registry *MockRegistry) Push(parsedCellImage *image.CellImage, fileBytes []byte, username, password string) error

Jump to

Keyboard shortcuts

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