test

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetActionItem added in v0.6.0

func SetActionItem(actionItem int) func(*MockCli)

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 SetClusterName added in v0.6.0

func SetClusterName(clusterName string) func(*MockKubeCli)

func SetConfig added in v0.6.0

func SetConfig(config []byte) func(*MockKubeCli)

func SetContexts added in v0.6.0

func SetContexts(contexts []string) func(*MockKubeCli)

func SetCredManager

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

func SetCredReader added in v0.6.0

func SetCredReader(reader credentials.CredReader) 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 SetReferenceJsonContent added in v0.6.0

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

func SetRegistry

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

func SetRepository

func SetRepository(repository string) func(*MockFileSystem)

func SetRuntime added in v0.6.0

func SetRuntime(runtime runtime.Runtime) func(*MockCli)

func SetServerVersion

func SetServerVersion(version string) func(*MockDockerCli)

SetServerVersion sets server version of mock docker cli.

func SetSysComponentStatus added in v0.6.0

func SetSysComponentStatus(status map[runtime.SystemComponent]bool) func(*MockRuntime)

func SetYamlContent

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

func SetYamlName

func SetYamlName(name string) func(*MockBalExecutor)

func WithCells

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

func WithCellsAsBytes

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

func WithComponents added in v0.6.0

func WithComponents(components kubernetes.Components) func(*MockKubeCli)

func WithComposites

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

func WithServices

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

func WithVirtualServices added in v0.6.0

func WithVirtualServices(virtualServices map[string]kubernetes.VirtualService) 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, cmdDir 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(workingDir, projectName, moduleName 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, cmdDir string) error

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

func (*MockBalExecutor) Test

func (balExecutor *MockBalExecutor) Test(args []string, envVars []*ballerina.EnvironmentVariable, cmdDir string) 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) CredReader added in v0.6.0

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

CredReader returns a CredReader 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) ExecuteUserSelection added in v0.6.0

func (cli *MockCli) ExecuteUserSelection(prompt string, options []cli.Selection) error

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.

func (*MockCli) Runtime added in v0.6.0

func (cli *MockCli) Runtime() runtime.Runtime

Runtime returns a Runtime instance.

func (*MockCli) Selection added in v0.6.0

func (cli *MockCli) Selection() cli.Selection

func (*MockCli) Sleep added in v0.6.0

func (cli *MockCli) Sleep(seconds time.Duration)

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 MockCredReader added in v0.6.0

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

func NewMockCredReader added in v0.6.0

func NewMockCredReader(opts ...func(*MockCredReader)) *MockCredReader

func (*MockCredReader) Read added in v0.6.0

func (mockCredReader *MockCredReader) Read() (string, string, error)

func (*MockCredReader) SetRegistry added in v0.6.0

func (mockCredReader *MockCredReader) SetRegistry(registry string)

func (*MockCredReader) SetUserName added in v0.6.0

func (mockCredReader *MockCredReader) SetUserName(username string)

func (*MockCredReader) Shutdown added in v0.6.0

func (mockCredReader *MockCredReader) Shutdown(authorized bool)

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) ApplyLabel added in v0.6.0

func (kubeCli *MockKubeCli) ApplyLabel(itemType, itemName, labelName string, overWrite bool) error

func (*MockKubeCli) CreateNamespace added in v0.6.0

func (kubeCli *MockKubeCli) CreateNamespace(namespace string) error

func (*MockKubeCli) DeleteAllCells added in v0.6.0

func (kubeCli *MockKubeCli) DeleteAllCells() error

func (*MockKubeCli) DeleteAllComposites added in v0.6.0

func (kubeCli *MockKubeCli) DeleteAllComposites() error

func (*MockKubeCli) DeleteNameSpace added in v0.6.0

func (kubeCli *MockKubeCli) DeleteNameSpace(nameSpace string) error

func (*MockKubeCli) DeletePersistedVolume added in v0.6.0

func (kubeCli *MockKubeCli) DeletePersistedVolume(persistedVolume 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) GetCells

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

GetCells returns cell instances array.

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) GetContext added in v0.6.0

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

func (*MockKubeCli) GetContexts added in v0.6.0

func (kubeCli *MockKubeCli) GetContexts() ([]byte, error)

func (*MockKubeCli) GetInstanceBytes

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

func (*MockKubeCli) GetInstancesNames

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

func (*MockKubeCli) GetMasterNodeName added in v0.6.0

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

func (*MockKubeCli) GetNamespace added in v0.6.0

func (kubeCli *MockKubeCli) GetNamespace(namespace string) ([]byte, 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) GetVirtualService added in v0.6.0

func (kubeCli *MockKubeCli) GetVirtualService(vs string) (kubernetes.VirtualService, error)

func (*MockKubeCli) IsComponentAvailable added in v0.6.0

func (kubeCli *MockKubeCli) IsComponentAvailable(instanceName, componentName string) error

func (*MockKubeCli) IsInstanceAvailable added in v0.6.0

func (kubeCli *MockKubeCli) IsInstanceAvailable(instanceName string) error

func (*MockKubeCli) JsonPatch

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

func (*MockKubeCli) SetNamespace added in v0.6.0

func (kubeCli *MockKubeCli) SetNamespace(namespace string) error

func (*MockKubeCli) SetVerboseMode

func (kubeCli *MockKubeCli) SetVerboseMode(enable bool)

func (*MockKubeCli) StreamCellLogsAllComponents added in v0.6.0

func (kubeCli *MockKubeCli) StreamCellLogsAllComponents(instanceName string, follow bool) error

func (*MockKubeCli) StreamCellLogsUserComponents added in v0.6.0

func (kubeCli *MockKubeCli) StreamCellLogsUserComponents(instanceName string, follow bool) error

func (*MockKubeCli) StreamComponentLogs added in v0.6.0

func (kubeCli *MockKubeCli) StreamComponentLogs(instanceName, componentName string, follow bool) error

func (*MockKubeCli) UseContext added in v0.6.0

func (kubeCli *MockKubeCli) UseContext(context string) error

func (*MockKubeCli) Version

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

type MockPlatform added in v0.6.0

type MockPlatform struct {
}

func NewMockPlatform added in v0.6.0

func NewMockPlatform(opts ...func(*MockPlatform)) *MockPlatform

NewMockPlatform returns a mock platform.

func (*MockPlatform) ClusterName added in v0.6.0

func (platform *MockPlatform) ClusterName() string

func (*MockPlatform) ConfigureSqlInstance added in v0.6.0

func (platform *MockPlatform) ConfigureSqlInstance() (runtime.MysqlDb, error)

func (*MockPlatform) CreateK8sCluster added in v0.6.0

func (platform *MockPlatform) CreateK8sCluster() (string, error)

func (*MockPlatform) CreateNfs added in v0.6.0

func (platform *MockPlatform) CreateNfs() (runtime.Nfs, error)

func (*MockPlatform) CreateStorage added in v0.6.0

func (platform *MockPlatform) CreateStorage() error

func (*MockPlatform) RemoveCluster added in v0.6.0

func (platform *MockPlatform) RemoveCluster() error

func (*MockPlatform) RemoveFileSystem added in v0.6.0

func (platform *MockPlatform) RemoveFileSystem() error

func (*MockPlatform) RemoveSqlInstance added in v0.6.0

func (platform *MockPlatform) RemoveSqlInstance() error

func (*MockPlatform) RemoveStorage added in v0.6.0

func (platform *MockPlatform) RemoveStorage() error

func (*MockPlatform) UpdateKubeConfig added in v0.6.0

func (platform *MockPlatform) UpdateKubeConfig() 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

type MockRuntime added in v0.6.0

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

func NewMockRuntime added in v0.6.0

func NewMockRuntime(opts ...func(*MockRuntime)) *MockRuntime

NewMockRuntime returns a mock runtime.

func (*MockRuntime) AddApim added in v0.6.0

func (runtime *MockRuntime) AddApim(isPersistentVolume bool) error

func (*MockRuntime) AddComponent added in v0.6.0

func (runtime *MockRuntime) AddComponent(component runtime.SystemComponent) error

func (*MockRuntime) AddIdp added in v0.6.0

func (runtime *MockRuntime) AddIdp() error

func (*MockRuntime) AddObservability added in v0.6.0

func (runtime *MockRuntime) AddObservability() error

func (*MockRuntime) ApplyIstioCrds added in v0.6.0

func (runtime *MockRuntime) ApplyIstioCrds() error

func (*MockRuntime) ApplyKnativeCrds added in v0.6.0

func (runtime *MockRuntime) ApplyKnativeCrds() error

func (*MockRuntime) Create added in v0.6.0

func (runtime *MockRuntime) Create() error

func (*MockRuntime) CreateCelleryNameSpace added in v0.6.0

func (runtime *MockRuntime) CreateCelleryNameSpace() error

func (*MockRuntime) CreateConfigMaps added in v0.6.0

func (runtime *MockRuntime) CreateConfigMaps() error

func (*MockRuntime) CreatePersistentVolume added in v0.6.0

func (runtime *MockRuntime) CreatePersistentVolume(hasNfs bool) error

func (*MockRuntime) CreatePersistentVolumeDirs added in v0.6.0

func (runtime *MockRuntime) CreatePersistentVolumeDirs() error

func (*MockRuntime) DeleteComponent added in v0.6.0

func (runtime *MockRuntime) DeleteComponent(component runtime.SystemComponent) error

func (*MockRuntime) InstallController added in v0.6.0

func (runtime *MockRuntime) InstallController() error

func (*MockRuntime) InstallIngressNginx added in v0.6.0

func (runtime *MockRuntime) InstallIngressNginx(isLoadBalancerIngressMode bool) error

func (*MockRuntime) InstallIstio added in v0.6.0

func (runtime *MockRuntime) InstallIstio() error

func (*MockRuntime) InstallKnativeServing added in v0.6.0

func (runtime *MockRuntime) InstallKnativeServing() error

func (*MockRuntime) InstallMysql added in v0.6.0

func (runtime *MockRuntime) InstallMysql(isPersistentVolume bool) error

func (*MockRuntime) IsComponentEnabled added in v0.6.0

func (runtime *MockRuntime) IsComponentEnabled(component runtime.SystemComponent) (bool, error)

func (*MockRuntime) IsGcpRuntime added in v0.6.0

func (runtime *MockRuntime) IsGcpRuntime() bool

func (*MockRuntime) IsHpaEnabled added in v0.6.0

func (runtime *MockRuntime) IsHpaEnabled() (bool, error)

func (*MockRuntime) SetArtifactsPath added in v0.6.0

func (runtime *MockRuntime) SetArtifactsPath(artifactsPath string)

func (*MockRuntime) UpdateInitSql added in v0.6.0

func (runtime *MockRuntime) UpdateInitSql(dbUserName, dbPassword string) error

func (*MockRuntime) UpdateMysqlCredentials added in v0.6.0

func (runtime *MockRuntime) UpdateMysqlCredentials(dbUserName, dbPassword, dbHost string) error

func (*MockRuntime) UpdateNfsServerDetails added in v0.6.0

func (runtime *MockRuntime) UpdateNfsServerDetails(ipAddress, fileShare string) error

func (*MockRuntime) UpdateNodePortIpAddress added in v0.6.0

func (runtime *MockRuntime) UpdateNodePortIpAddress(nodePortIpAddress string) error

func (*MockRuntime) Validate added in v0.6.0

func (runtime *MockRuntime) Validate() error

func (*MockRuntime) WaitFor added in v0.6.0

func (runtime *MockRuntime) WaitFor(checkKnative, hpaEnabled bool) error

Jump to

Keyboard shortcuts

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