testingutil

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupEnv added in v0.0.14

func CleanupEnv(confFiles []*os.File, t *testing.T)

CleanupEnv cleans up the mock config file and anything that SetupEnv generated Parameters:

configFile: the mock config file handler
t: testing pointer to log errors if any

func FakeDeploymentConfigs added in v0.0.10

func FakeDeploymentConfigs() *v1.DeploymentConfigList

func FakeImageStreams

func FakeImageStreams(imageName string, namespace string, tags []string) *imagev1.ImageStreamList

FakeImageStreams lists the imagestreams for the reactor

func FakeKubeClientConfig added in v0.0.14

func FakeKubeClientConfig() string

FakeKubeClientConfig returns mock kube client config

func FakeOdoConfig added in v0.0.14

func FakeOdoConfig(confPath string, needNamePrefix bool, namePrefix string) config.ConfigInfo

FakeOdoConfig returns mock odo config It takes a confPath which is the path to the config

func FakeOnlyOneExistingProjects added in v0.0.14

func FakeOnlyOneExistingProjects() *v1.ProjectList

FakeOnlyOneExistingProjects returns fake projectlist with single project for use by API mock functions for Unit tests testing delete of the only available project

func FakeProjectStatus added in v0.0.14

func FakeProjectStatus(prjStatus corev1.NamespacePhase, prjName string) *projectv1.Project

FakeProjectStatus returns fake project status for use by mock watch on project

func FakeProjects added in v0.0.11

func FakeProjects() *v1.ProjectList

FakeProjects returns fake projectlist for use by API mock functions for Unit tests

func FakeRemoveProject added in v0.0.14

func FakeRemoveProject(project string, projects *v1.ProjectList) *v1.ProjectList

FakeRemoveProject removes the delete requested project from the list of projects passed

func SetUp added in v0.0.14

func SetUp(odoConfigDetails ConfigDetails, kubeConfigDetails ConfigDetails) (*os.File, *os.File, error)

SetUp sets up the odo and kube config files and returns respective conf file pointers and error

func SimulateFileModifications added in v0.0.15

func SimulateFileModifications(basePath string, fileModification FileProperties) (string, error)

SimulateFileModifications mock function to simulate requested file/folder operation Parameters:

basePath: The parent directory for file/folder involved in desired file operation
fileModification: Meta-data of file/folder

Returns:

path to file/folder involved in the operation
error if any or nil

func TempMkFile added in v0.0.15

func TempMkFile(dir string, fileName string) (string, error)

TempMkFile creates a temporary file.

func TempMkdir added in v0.0.15

func TempMkdir(parentDir string, newDirPrefix string) (string, error)

TempMkdir creates a temporary directory

Types

type ConfigDetails added in v0.0.14

type ConfigDetails struct {
	FileName      string
	Config        interface{}
	ConfigPathEnv string
}

ConfigDetails struct holds configuration details(odo and/or kube config)

type FileProperties added in v0.0.15

type FileProperties struct {
	FilePath         string
	FileParent       string
	FileType         FileType
	ModificationType ModificationType
}

FileProperties to contain meta-data of a file like, file/folder name, file/folder parent dir, file type and desired file modification type

type FileType added in v0.0.15

type FileType int

FileType custom type to indicate type of file

const (
	// RegularFile enum to represent regular file
	RegularFile FileType = 0
	// Directory enum to represent directory
	Directory FileType = 1
)

type ModificationType added in v0.0.15

type ModificationType string

ModificationType custom type to indicate file modification type

const (
	// UPDATE enum representing update operation on a file
	UPDATE ModificationType = "update"
	// CREATE enum representing create operation for a file/folder
	CREATE ModificationType = "create"
	// DELETE enum representing delete operation for a file/folder
	DELETE ModificationType = "delete"
	// APPEND enum representing append operation on a file
	APPEND ModificationType = "append"
)

Jump to

Keyboard shortcuts

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