testhelpers

package
v0.0.0-...-0d7ecfb Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCanSafelyRunReportingTests

func AssertCanSafelyRunReportingTests(t *testing.T, err error, expectInstallErr bool, errMsgArr []string) bool

func AssertErrorContainsErrorMsgs

func AssertErrorContainsErrorMsgs(t *testing.T, err error, errMsgArr []string)

func AssertReportResultsEqual

func AssertReportResultsEqual(t *testing.T, expected, actual []map[string]interface{}, comparisonColumnNames []string)

func DecodeMeteringConfigManifest

func DecodeMeteringConfigManifest(basePath, manifestPath, manifestFilename string) (*metering.MeteringConfig, error)

func ExecPodCommandWithOptions

func ExecPodCommandWithOptions(config *rest.Config, client kubernetes.Interface, options *ExecActionOptions) (bytes.Buffer, bytes.Buffer, error)

func GatherRegistryResources

func GatherRegistryResources(outputPath, scriptPath, name, namespace string) error

GatherRegistryResources is a test helper function responsible for providing inputs and executing the @scriptPath bash script, which dumps out the YAML manifest for the CatalogSource and the corresponding PackageManifest resources that were used to deploy a custom version of Metering.

func NewPrestoTable

func NewPrestoTable(name, namespace, catalog, schema string, columns []presto.Column) *metering.PrestoTable

func NewReport

func NewReport(
	name string,
	namespace string,
	testQueryName string,
	inputs metering.ReportQueryInputValues,
	reportStart *time.Time,
	reportEnd *time.Time,
	status metering.ReportStatus,
	schedule *metering.ReportSchedule,
	runImmediately bool,
	expiration *meta.Duration,
) *metering.Report

NewReport creates a mock report used for testing purposes.

func NewReportDataSource

func NewReportDataSource(name, namespace string) *metering.ReportDataSource

func NewReportQuery

func NewReportQuery(name, namespace string, columns []metering.ReportQueryColumn) *metering.ReportQuery

func PtrToBool

func PtrToBool(val bool) *bool

func SetupLogger

func SetupLogger(logLevelStr string) logrus.FieldLogger

func SetupLoggerToFile

func SetupLoggerToFile(path, logLevel string, fields logrus.Fields) (logrus.FieldLogger, *os.File, error)

SetupLoggerToFile is a helper function that initializes and returns a logrus FieldLogger instance that directs its output to the @path file instead of os.Stdout.

Types

type ExecActionOptions

type ExecActionOptions struct {
	Name      string
	Namespace string
	Container string
	Command   []string
	UseTTY    bool
}

ExecActionOptions holds all the metadata required to fire off a Pod exec REST API call. This is mainly a wrapper around the corev1.ExecAction type: https://pkg.go.dev/k8s.io/api/core/v1?tab=doc#ExecAction

func NewExecOptions

func NewExecOptions(name, namespace, container string, useTTY bool, cmd []string) *ExecActionOptions

type ReportDataSourceStore

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

func NewReportDataSourceStore

func NewReportDataSourceStore(datasources []*metering.ReportDataSource) (store *ReportDataSourceStore)

func (*ReportDataSourceStore) GetReportDataSource

func (store *ReportDataSourceStore) GetReportDataSource(namespace, name string) (*metering.ReportDataSource, error)

type ReportQueryStore

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

func NewReportQueryStore

func NewReportQueryStore(queries []*metering.ReportQuery) (store *ReportQueryStore)

func (*ReportQueryStore) GetReportQuery

func (store *ReportQueryStore) GetReportQuery(namespace, name string) (*metering.ReportQuery, error)

type ReportStore

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

func NewReportStore

func NewReportStore(reports []*metering.Report) (store *ReportStore)

func (*ReportStore) GetReport

func (store *ReportStore) GetReport(namespace, name string) (*metering.Report, error)

Jump to

Keyboard shortcuts

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