test

package
v0.0.0-...-9b56418 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddTrailingSlashes = func(source repository.Cluster) repository.Cluster {
	source.URL = httpsupport.AddTrailingSlashToURL(source.URL)
	source.ConsoleURL = httpsupport.AddTrailingSlashToURL(source.ConsoleURL)
	source.LoggingURL = httpsupport.AddTrailingSlashToURL(source.LoggingURL)
	source.MetricsURL = httpsupport.AddTrailingSlashToURL(source.MetricsURL)
	return source
}

AddTrailingSlashes a normalize function which converts all URL by adding a trailing slash if needed

Functions

func AssertClusters

func AssertClusters(t *testing.T, expected []repository.Cluster, actual repository.Cluster, expectSensitiveInfo bool)

AssertClusters verifies that the `actual` cluster belongs to the `expected`, and compares all fields including sensitive details if `expectSensitiveInfo` is `true`

func AssertContainsClusters

func AssertContainsClusters(t *testing.T, expected, contains []repository.Cluster, expectSensitiveInfo bool)

AssertContainsClusters verifies that all the list of `expected` clusters contains the given list of clusters

func AssertEqualCluster

func AssertEqualCluster(t *testing.T, expected, actual repository.Cluster, expectSensitiveInfo bool)

AssertEqualCluster verifies that the `actual` and `expected` clusters are have the same values including sensitive details if `expectSensitiveInfo` is `true`

func AssertEqualClusterData

func AssertEqualClusterData(t *testing.T, expected repository.Cluster, actual app.ClusterData)

AssertEqualClusterData verifies that data for actual cluster match the expected one

func AssertEqualClusterDetails

func AssertEqualClusterDetails(t *testing.T, expected, actual repository.Cluster, expectSensitiveInfo bool)

AssertEqualClusterDetails verifies that the `actual` and `expected` clusters are have the same values including sensitive details if `expectSensitiveInfo` is `true`

func AssertEqualClusters

func AssertEqualClusters(t *testing.T, expected, actual []repository.Cluster, expectSensitiveInfo bool)

AssertEqualClusters verifies that all the `actual` and `expected` clusters are have the same values including sensitive details if `expectSensitiveInfo` is `true`

func AssertEqualClustersData

func AssertEqualClustersData(t *testing.T, expected []repository.Cluster, actual []*app.ClusterData)

AssertEqualClustersData verifies that data for all actual clusters match the expected ones

func AssertEqualFullClusterData

func AssertEqualFullClusterData(t *testing.T, expected repository.Cluster, actual app.FullClusterData)

AssertEqualFullClusterData verifies that data for actual cluster match the expected one

func AssertEqualFullClustersData

func AssertEqualFullClustersData(t *testing.T, expected []repository.Cluster, actual []*app.FullClusterData)

AssertEqualFullClustersData verifies that data for all actual clusters match the expected ones

func AssertEqualIdentityClusters

func AssertEqualIdentityClusters(t *testing.T, expected, actual repository.IdentityCluster)

AssertEqualIdentityClusters verifies that the identity/cluster links are equal

func AssertError

func AssertError(t require.TestingT, actualError error, expectedType interface{}, expectedMsgAndArgs ...interface{})

AssertError verifies that the given error has the expected type and message

func CreateCluster

func CreateCluster(t *testing.T, db *gorm.DB, options ...createClusterOption) repository.Cluster

CreateCluster returns a new cluster after saves it in the DB

func CreateIdentityCluster

func CreateIdentityCluster(t *testing.T, db *gorm.DB, options ...CreateIdentityClusterOption) repository.IdentityCluster

CreateIdentityCluster returns a new IdentityCluster after saving it in the DB. if no identity or cluster was provided in the options, a random UUID is used for the identity ID and a new cluster is created on the fly

func FilterClusterByURL

func FilterClusterByURL(url string, clusters []repository.Cluster) (repository.Cluster, error)

FilterClusterByURL returns the cluster that has the given URL or an error if none was found

func NewCluster

func NewCluster(options ...createClusterOption) repository.Cluster

NewCluster returns a new cluster with random values for all fields

func Normalize

func Normalize(source repository.Cluster, changes ...NormalizeCluster) repository.Cluster

Normalize returns a new cluster based on the source option, with normalization functions applied

func Run

func Run(b *testing.B, suite BenchingSuite)

Run takes a testing suite and runs all of the benchmarks attached to it.

func WithType

func WithType(t string) func(*repository.Cluster)

WithType an option to specify the type of the cluster to create

Types

type AfterBenchmark

type AfterBenchmark interface {
	AfterBenchmark(suiteName, testName string)
}

AfterBenchmark has a function to be executed right after the benchmark finishes and receives the suite and benchmark names as input

type BeforeBenchmark

type BeforeBenchmark interface {
	BeforeBenchmark(suiteName, testName string)
}

BeforeBenchmark has a function to be executed right before the benchmark starts and receives the suite and benchmark names as input

type BenchingSuite

type BenchingSuite interface {
	B() *testing.B
	SetB(*testing.B)
}

BenchingSuite can store and return the current *testing.B context generated by 'go test -bench=.'.

type CreateIdentityClusterOption

type CreateIdentityClusterOption func(*repository.IdentityCluster)

CreateIdentityClusterOption an option to configure the identity/cluster link to create

func WithCluster

WithCluster an option to specify the cluster to use when linking to an identity

func WithIdentityID

func WithIdentityID(identityID uuid.UUID) CreateIdentityClusterOption

WithIdentityID an option to specify the identity to use when linking to a cluster

type NormalizeCluster

type NormalizeCluster func(repository.Cluster) repository.Cluster

NormalizeCluster a function to normalize one or more field in a given cluster

type SetupAllSuite

type SetupAllSuite interface {
	SetupSuite()
}

SetupAllSuite has a SetupSuite method, which will run before the benchmarks in the suite are run.

type SetupBenchmarkSuite

type SetupBenchmarkSuite interface {
	SetupBenchmark()
}

SetupBenchmarkSuite has a SetupBenchmark method, which will run before each benchmark in the suite.

type Suite

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

Suite is a basic testing suite with methods for storing and retrieving the current *testing.B context.

func (*Suite) B

func (suite *Suite) B() *testing.B

B retrieves the current *testing.B context.

func (*Suite) SetB

func (suite *Suite) SetB(b *testing.B)

SetB sets the current *testing.B context.

type TearDownAllSuite

type TearDownAllSuite interface {
	TearDownSuite()
}

TearDownAllSuite has a TearDownSuite method, which will run after all the benchmarks in the suite have been run.

type TearDownBenchmarkSuite

type TearDownBenchmarkSuite interface {
	TearDownBenchmark()
}

TearDownBenchmarkSuite has a TearDownBenchmark method, which will run after each benchmark in the suite.

Jump to

Keyboard shortcuts

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