reportingframework

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: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReportingFramework

type ReportingFramework struct {
	MeteringClient meteringv1.MeteringV1Interface
	KubeClient     kubernetes.Interface
	RouteClient    routev1client.RouteV1Client
	KubeConfig     *rest.Config
	HTTPClient     *http.Client

	Namespace             string
	KubeAPIPath           string
	RouteBearerToken      string
	ReportOutputDirectory string

	UseKubeProxyForReportingAPI bool
	UseRouteForReportingAPI     bool
	HTTPSAPI                    bool
	KubeAPIURL                  *url.URL
	ReportingAPIURL             *url.URL

	DefaultTimeout time.Duration
	// contains filtered or unexported fields
}

ReportingFramework is a type responsible for storing all of the state necessary to perform post-install tests against a particular metering installation.

func New

func New(
	httpsAPI,
	useKubeProxyForReportingAPI,
	useRouteForReportingAPI bool,
	namespace,
	routeBearerToken,
	reportingAPIURL,
	reportOutputDir string,
	kubeconfig *rest.Config,
	kubeClient kubernetes.Interface,
	meteringClient meteringv1.MeteringV1Interface,
) (*ReportingFramework, error)

New initializes a test reporting framework and returns it.

func (*ReportingFramework) CollectMetricsOnce

func (*ReportingFramework) CreateMeteringReport

func (rf *ReportingFramework) CreateMeteringReport(report *metering.Report) error

func (*ReportingFramework) CreateReportQuery

func (rf *ReportingFramework) CreateReportQuery(rq *metering.ReportQuery) error

CreateReportQuery is a helper method that creates the @rq ReportQuery using the interal Meteringv1 clientset.

func (*ReportingFramework) CreateReportQueryWithContext

func (rf *ReportingFramework) CreateReportQueryWithContext(ctx context.Context, rq *metering.ReportQuery) error

CreateReportQueryWithContext is a helper method that creates the @rq ReportQuery using context provided to the interal Meteringv1 clientset.

func (*ReportingFramework) GetMeteringReport

func (rf *ReportingFramework) GetMeteringReport(name string) (*metering.Report, error)

func (*ReportingFramework) GetMeteringReportDataSource

func (rf *ReportingFramework) GetMeteringReportDataSource(name string) (*metering.ReportDataSource, error)

GetMeteringReportDataSource is a helper method that is responsible for making the API call querying for the @name reportdatsource in the rf.Namespace namespace.

func (*ReportingFramework) GetMeteringReportQuery

func (rf *ReportingFramework) GetMeteringReportQuery(name string) (*metering.ReportQuery, error)

func (*ReportingFramework) GetPrestoTable

func (rf *ReportingFramework) GetPrestoTable(name string) (*metering.PrestoTable, error)

GetPrestoTable is a reportingframework method that makes the client-go API request for the @name PrestoTable.

func (*ReportingFramework) GetReportResults

func (rf *ReportingFramework) GetReportResults(t *testing.T, report *metering.Report, waitTimeout time.Duration) []map[string]interface{}

func (*ReportingFramework) NewSimpleReport

func (rf *ReportingFramework) NewSimpleReport(name, queryName string, schedule *metering.ReportSchedule, reportingStart, reportingEnd *time.Time, expiration *metav1.Duration) *metering.Report

func (*ReportingFramework) PrestoTableExists

func (rf *ReportingFramework) PrestoTableExists(t *testing.T, name string) (bool, error)

PrestoTableExists is a reportingframework method that determines whether or not the @name PrestoTable custom resource in the rf.Namespace namespace has a populated database table in Presto.

func (*ReportingFramework) ReportingOperatorGetRequest

func (rf *ReportingFramework) ReportingOperatorGetRequest(endpoint string, query map[string]string) (respBody []byte, code int, err error)

ReportingOperatorGetRequest is a reportingframework method that performs a single GET request to the metering API.

func (*ReportingFramework) ReportingOperatorPOSTRequest

func (rf *ReportingFramework) ReportingOperatorPOSTRequest(endpoint string, body []byte) (respBody []byte, code int, err error)

ReportingOperatorPOSTRequest is a reportingframework method that performs a single POST request to the metering API.

func (*ReportingFramework) RequireReportDataSourcesForQueryHaveData

func (rf *ReportingFramework) RequireReportDataSourcesForQueryHaveData(t *testing.T, queries []string, collectResp operator.CollectPrometheusMetricsDataResponse)

func (*ReportingFramework) RequireReportQueriesReady

func (rf *ReportingFramework) RequireReportQueriesReady(t *testing.T, queries []string, pollInterval, timeout time.Duration)

func (*ReportingFramework) RequireReportSuccessfullyRuns

func (rf *ReportingFramework) RequireReportSuccessfullyRuns(t *testing.T, report *metering.Report, waitTimeout time.Duration)

func (*ReportingFramework) StoreDataSourceData

func (rf *ReportingFramework) StoreDataSourceData(dataSourceName string, metrics []*prestostore.PrometheusMetric) error

StoreDataSourceData is a reportingframework method responsible for making the metering push API call to inject the list of @metrics prometheus metrics into a particular ReportDatasource custom resource database table.

func (*ReportingFramework) WaitForAllMeteringReportDataSourceTables

func (rf *ReportingFramework) WaitForAllMeteringReportDataSourceTables(t *testing.T, pollInterval, timeout time.Duration) ([]*metering.ReportDataSource, error)

WaitForAllMeteringReportDataSourceTables is a helper method responsible for ensuring that all of the reportdatasource custom resources in the rf.Namespace are ready to run

func (*ReportingFramework) WaitForMeteringReportDataSource

func (rf *ReportingFramework) WaitForMeteringReportDataSource(t *testing.T, name string, pollInterval, timeout time.Duration, dsFunc func(ds *metering.ReportDataSource) (bool, error)) (*metering.ReportDataSource, error)

func (*ReportingFramework) WaitForMeteringReportDataSourceTable

func (rf *ReportingFramework) WaitForMeteringReportDataSourceTable(t *testing.T, name string, pollInterval, timeout time.Duration) (*metering.ReportDataSource, error)

WaitForMeteringReportDataSourceTable is a helper method responsible for ensuring that the @name reportdatasource custom resource in the rf.Namespace testing namespace is reporting a ready status. We define "ready" here as having a populated PrestoTable object reference.

func (*ReportingFramework) WaitForMeteringReportQuery

func (rf *ReportingFramework) WaitForMeteringReportQuery(t *testing.T, name string, pollInterval, timeout time.Duration) (*metering.ReportQuery, error)

func (*ReportingFramework) WaitForPrestoTable

func (rf *ReportingFramework) WaitForPrestoTable(t *testing.T, name string, pollInterval, timeout time.Duration, tableFunc func(table *metering.PrestoTable) (bool, error)) (*metering.PrestoTable, error)

WaitForPrestoTable is a reportingframework method responsbile for ensuring that the @name PrestoTable custom resource in the rf.Namespace namespace has is reporting a ready status. We define "ready" here based on the @tableFunc anonymous function parameter.

func (*ReportingFramework) WaitForReportDataSourcePrestoTable

func (rf *ReportingFramework) WaitForReportDataSourcePrestoTable(t *testing.T, ds *metering.ReportDataSource, pollInterval, timeout time.Duration) (bool, error)

Jump to

Keyboard shortcuts

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