testutils

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertBufferContents

func AssertBufferContents(entries []toc.MetadataEntry, buffer *Buffer, expected ...string)

func BufferLength

func BufferLength(buffer *Buffer) uint64

func ClassIDFromObjectName

func ClassIDFromObjectName(objName string) uint32

func CompareSlicesIgnoringWhitespace

func CompareSlicesIgnoringWhitespace(actual []string, expected []string) bool

func CreateSecurityLabelIfGPDB6

func CreateSecurityLabelIfGPDB6(connectionPool *dbconn.DBConn, objectType string, objectName string)

func DefaultACLForType

func DefaultACLForType(grantee string, objType string) backup.ACL

func DefaultACLForTypeWithGrant

func DefaultACLForTypeWithGrant(grantee string, objType string) backup.ACL

func DefaultACLWithGrantWithout

func DefaultACLWithGrantWithout(grantee string, objType string, revoke ...string) backup.ACL

func DefaultACLWithout

func DefaultACLWithout(grantee string, objType string, revoke ...string) backup.ACL

func DefaultMetadata

func DefaultMetadata(objType string, hasPrivileges bool, hasOwner bool, hasComment bool, hasSecurityLabel bool) backup.ObjectMetadata

func DefaultMetadataMap

func DefaultMetadataMap(objType string, hasPrivileges bool, hasOwner bool, hasComment bool, hasSecurityLabel bool) backup.MetadataMap

objType should be an all-caps string like TABLE, INDEX, etc.

func DestroyTestFilespace

func DestroyTestFilespace(connectionPool *dbconn.DBConn)

func ExecuteSQLFile

func ExecuteSQLFile(connectionPool *dbconn.DBConn, filename string)

func ExpectEntry

func ExpectEntry(entries []toc.MetadataEntry, index int, schema, referenceObject, name, objectType string)

func ExpectEntryCount

func ExpectEntryCount(entries []toc.MetadataEntry, index int)

func GetUserByID

func GetUserByID(connectionPool *dbconn.DBConn, oid uint32) string

func InitializeTestTOC

func InitializeTestTOC(buffer io.Writer, which string) (*toc.TOC, *utils.FileWithByteCount)

func OidFromCast

func OidFromCast(connectionPool *dbconn.DBConn, castSource uint32, castTarget uint32) uint32

func OidFromObjectName

func OidFromObjectName(connectionPool *dbconn.DBConn, schemaName string, objectName string, params backup.MetadataQueryParams) uint32

func SetDefaultSegmentConfiguration

func SetDefaultSegmentConfiguration() *cluster.Cluster

func SetupTestCluster

func SetupTestCluster() *cluster.Cluster

func SetupTestDBConnSegment

func SetupTestDBConnSegment(dbname string, port int, gpVersion dbconn.GPDBVersion) *dbconn.DBConn

Connects to specific segment in utility mode

func SetupTestDbConn

func SetupTestDbConn(dbname string) *dbconn.DBConn

func SetupTestEnvironment

func SetupTestEnvironment() (*dbconn.DBConn, sqlmock.Sqlmock, *Buffer, *Buffer, *Buffer)

func SetupTestFilespace

func SetupTestFilespace(connectionPool *dbconn.DBConn, testCluster *cluster.Cluster)

func SkipIfBefore5

func SkipIfBefore5(connectionPool *dbconn.DBConn)

func SkipIfBefore6

func SkipIfBefore6(connectionPool *dbconn.DBConn)

func SkipIfBefore7

func SkipIfBefore7(connectionPool *dbconn.DBConn)

func SkipIfNot4

func SkipIfNot4(connectionPool *dbconn.DBConn)

func SliceBufferByEntries

func SliceBufferByEntries(entries []toc.MetadataEntry, buffer *Buffer) ([]string, string)

func UniqueIDFromObjectName

func UniqueIDFromObjectName(connectionPool *dbconn.DBConn, schemaName string, objectName string, params backup.MetadataQueryParams) backup.UniqueID

Types

type TestExecutorMultiple

type TestExecutorMultiple struct {
	ClusterOutputs      []*cluster.RemoteOutput
	ClusterCommands     [][]cluster.ShellCommand
	ErrorOnExecNum      int // Throw the specified error after this many executions of Execute[...]Command(); 0 means always return error
	NumLocalExecutions  int
	NumRemoteExecutions int
	LocalOutput         string
	LocalError          error
	LocalCommands       []string
}

func (*TestExecutorMultiple) ExecuteClusterCommand

func (executor *TestExecutorMultiple) ExecuteClusterCommand(scope cluster.Scope, commands []cluster.ShellCommand) (result *cluster.RemoteOutput)

func (*TestExecutorMultiple) ExecuteLocalCommand

func (executor *TestExecutorMultiple) ExecuteLocalCommand(commandStr string) (string, error)

Jump to

Keyboard shortcuts

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