integrations

package
v2.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFlakyRetryCount      = 5
	DefaultFlakyTotalRetryCount = 1_000
)

Variables

This section is empty.

Functions

func EnsureCiVisibilityInitialization

func EnsureCiVisibilityInitialization()

EnsureCiVisibilityInitialization initializes the CI visibility tracer if it hasn't been initialized already.

func ExitCiVisibility

func ExitCiVisibility()

ExitCiVisibility executes all registered close actions and stops the tracer.

func GetEarlyFlakeDetectionSettings

func GetEarlyFlakeDetectionSettings() *net.EfdResponseData

GetEarlyFlakeDetectionSettings gets the early flake detection known tests data

func GetSettings

func GetSettings() *net.SettingsResponseData

GetSettings gets the settings from the backend settings endpoint

func GetSkippableTests

func GetSkippableTests() map[string]map[string][]net.SkippableResponseDataAttributes

GetSkippableTests gets the skippable tests from the backend

func InitializeCIVisibilityMock

func InitializeCIVisibilityMock() mocktracer.Tracer

InitializeCIVisibilityMock initialize the mocktracer for CI Visibility usage

func PushCiVisibilityCloseAction

func PushCiVisibilityCloseAction(action ciVisibilityCloseAction)

PushCiVisibilityCloseAction adds a close action to be executed when CI visibility exits.

Types

type ErrorOption

type ErrorOption func(*tslvErrorOptions)

ErrorOption is a function that sets an option for creating an error.

func WithError

func WithError(err error) ErrorOption

WithError sets the error on the options.

func WithErrorInfo

func WithErrorInfo(errType string, message string, callstack string) ErrorOption

WithErrorInfo sets detailed error information on the options.

type FlakyRetriesSetting

type FlakyRetriesSetting struct {
	RetryCount               int64
	TotalRetryCount          int64
	RemainingTotalRetryCount int64
}

FlakyRetriesSetting struct to hold all the settings related to flaky tests retries

func GetFlakyRetriesSettings

func GetFlakyRetriesSettings() *FlakyRetriesSetting

GetFlakyRetriesSettings gets the flaky retries settings

type Test

type Test interface {

	// TestID returns the ID of the test.
	TestID() uint64

	// Name returns the name of the test.
	Name() string

	// Suite returns the suite to which the test belongs.
	Suite() TestSuite

	// Close closes the test with the given status.
	Close(status TestResultStatus, options ...TestCloseOption)

	// SetTestFunc sets the function to be tested. (Sets the test.source tags and test.codeowners)
	SetTestFunc(fn *runtime.Func)

	// SetBenchmarkData sets benchmark data for the test.
	SetBenchmarkData(measureType string, data map[string]any)
	// contains filtered or unexported methods
}

Test represents an individual test within a suite.

type TestCloseOption

type TestCloseOption func(*tslvTestCloseOptions)

TestCloseOption represents an option for closing a test.

func WithTestFinishTime

func WithTestFinishTime(finishTime time.Time) TestCloseOption

WithTestFinishTime sets the finish time of the test.

func WithTestSkipReason

func WithTestSkipReason(skipReason string) TestCloseOption

WithTestSkipReason sets the skip reason of the test.

type TestModule

type TestModule interface {

	// ModuleID returns the ID of the module.
	ModuleID() uint64

	// Session returns the test session to which the module belongs.
	Session() TestSession

	// Framework returns the testing framework used by the module.
	Framework() string

	// Name returns the name of the module.
	Name() string

	// Close closes the test module.
	Close(options ...TestModuleCloseOption)

	// GetOrCreateSuite returns an existing suite or creates a new one with the given name.
	GetOrCreateSuite(name string, options ...TestSuiteStartOption) TestSuite
	// contains filtered or unexported methods
}

TestModule represents a module within a test session.

type TestModuleCloseOption

type TestModuleCloseOption func(*tslvTestModuleCloseOptions)

TestModuleCloseOption represents an option for closing a test module.

func WithTestModuleFinishTime

func WithTestModuleFinishTime(finishTime time.Time) TestModuleCloseOption

WithTestModuleFinishTime sets the finish time for closing the test module.

type TestModuleStartOption

type TestModuleStartOption func(*tslvTestModuleStartOptions)

TestModuleStartOption represents an option that can be passed to GetOrCreateModule.

func WithTestModuleFramework

func WithTestModuleFramework(framework, frameworkVersion string) TestModuleStartOption

WithTestModuleFramework sets the testing framework used by the test module.

func WithTestModuleStartTime

func WithTestModuleStartTime(startTime time.Time) TestModuleStartOption

WithTestModuleStartTime sets the start time of the test module.

type TestResultStatus

type TestResultStatus int

TestResultStatus represents the result status of a test.

const (
	// ResultStatusPass indicates that the test has passed.
	ResultStatusPass TestResultStatus = 0

	// ResultStatusFail indicates that the test has failed.
	ResultStatusFail TestResultStatus = 1

	// ResultStatusSkip indicates that the test has been skipped.
	ResultStatusSkip TestResultStatus = 2
)

type TestSession

type TestSession interface {

	// SessionID returns the ID of the session.
	SessionID() uint64

	// Command returns the command used to run the session.
	Command() string

	// Framework returns the testing framework used.
	Framework() string

	// WorkingDirectory returns the working directory of the session.
	WorkingDirectory() string

	// Close closes the test session with the given exit code.
	Close(exitCode int, options ...TestSessionCloseOption)

	// GetOrCreateModule returns an existing module or creates a new one with the given name.
	GetOrCreateModule(name string, options ...TestModuleStartOption) TestModule
	// contains filtered or unexported methods
}

TestSession represents a session for a set of tests.

func CreateTestSession

func CreateTestSession(options ...TestSessionStartOption) TestSession

CreateTestSession initializes a new test session with the given command and working directory.

type TestSessionCloseOption

type TestSessionCloseOption func(*tslvTestSessionCloseOptions)

TestSessionCloseOption represents an option that can be passed to Close.

func WithTestSessionFinishTime

func WithTestSessionFinishTime(finishTime time.Time) TestSessionCloseOption

WithTestSessionFinishTime sets the finish time of the test session.

type TestSessionStartOption

type TestSessionStartOption func(*tslvTestSessionStartOptions)

TestSessionStartOption represents an option that can be passed to CreateTestSession.

func WithTestSessionCommand

func WithTestSessionCommand(command string) TestSessionStartOption

WithTestSessionCommand sets the command used to run the test session.

func WithTestSessionFramework

func WithTestSessionFramework(framework, frameworkVersion string) TestSessionStartOption

WithTestSessionFramework sets the testing framework used in the test session.

func WithTestSessionStartTime

func WithTestSessionStartTime(startTime time.Time) TestSessionStartOption

WithTestSessionStartTime sets the start time of the test session.

func WithTestSessionWorkingDirectory

func WithTestSessionWorkingDirectory(workingDirectory string) TestSessionStartOption

WithTestSessionWorkingDirectory sets the working directory of the test session.

type TestStartOption

type TestStartOption func(*tslvTestStartOptions)

TestStartOption represents an option for starting a test.

func WithTestStartTime

func WithTestStartTime(startTime time.Time) TestStartOption

WithTestStartTime sets the start time for starting a test.

type TestSuite

type TestSuite interface {

	// SuiteID returns the ID of the suite.
	SuiteID() uint64

	// Module returns the module to which the suite belongs.
	Module() TestModule

	// Name returns the name of the suite.
	Name() string

	// Close closes the test suite.
	Close(options ...TestSuiteCloseOption)

	// CreateTest creates a new test with the given name and options.
	CreateTest(name string, options ...TestStartOption) Test
	// contains filtered or unexported methods
}

TestSuite represents a suite of tests within a module.

type TestSuiteCloseOption

type TestSuiteCloseOption func(*tslvTestSuiteCloseOptions)

TestSuiteCloseOption represents an option for closing a test suite.

func WithTestSuiteFinishTime

func WithTestSuiteFinishTime(finishTime time.Time) TestSuiteCloseOption

WithTestSuiteFinishTime sets the finish time for closing the test suite.

type TestSuiteStartOption

type TestSuiteStartOption func(*tslvTestSuiteStartOptions)

TestSuiteStartOption represents an option for starting a test suite.

func WithTestSuiteStartTime

func WithTestSuiteStartTime(startTime time.Time) TestSuiteStartOption

WithTestSuiteStartTime sets the start time for starting a test suite.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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