testutils

package
v0.0.0-...-015189f Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright Contributors to the Open Cluster Management project

Copyright Contributors to the Open Cluster Management project

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockDatabaseState

func MockDatabaseState(mockPool *pgxpoolmock.MockPgxPool)

Mocks the existing state of the database for the test-cluster.

func SupressConsoleOutput

func SupressConsoleOutput() func()

Supress console output to prevent log messages from polluting test output.

Types

type MockBatchResults

type MockBatchResults struct {
	MockRows
	Index            int
	MockErrorOnClose error // Return an error on Close()
	MockErrorOnExec  error // Return an error on Exec()
	MockErrorOnQuery error // Return an error on Query()
}

=========================================================== Mock the BatchResults interface defined in the pgx library. https://github.com/jackc/pgx/blob/master/batch.go#L34 ===========================================================

func (*MockBatchResults) Close

func (br *MockBatchResults) Close() error

func (*MockBatchResults) Exec

func (br *MockBatchResults) Exec() (pgconn.CommandTag, error)

func (*MockBatchResults) Query

func (br *MockBatchResults) Query() (pgx.Rows, error)

func (*MockBatchResults) QueryFunc

func (br *MockBatchResults) QueryFunc(scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)

func (*MockBatchResults) QueryRow

func (br *MockBatchResults) QueryRow() pgx.Row

type MockRows

type MockRows struct {
	MockData        []map[string]interface{}
	Index           int
	ColumnHeaders   []string
	MockErrorOnScan error
}

==================================================== Mock the Rows interface defined in the pgx library. https://github.com/jackc/pgx/blob/master/rows.go#L26 ====================================================

func (*MockRows) Close

func (r *MockRows) Close()

func (*MockRows) CommandTag

func (r *MockRows) CommandTag() pgconn.CommandTag

func (*MockRows) Err

func (r *MockRows) Err() error

func (*MockRows) FieldDescriptions

func (r *MockRows) FieldDescriptions() []pgproto3.FieldDescription

func (*MockRows) Next

func (r *MockRows) Next() bool

func (*MockRows) RawValues

func (r *MockRows) RawValues() [][]byte

func (*MockRows) Scan

func (r *MockRows) Scan(dest ...interface{}) error

func (*MockRows) Values

func (r *MockRows) Values() ([]interface{}, error)

Jump to

Keyboard shortcuts

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