test

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthTest

func AuthTest(t *testing.T, testFunc func(t *testing.T))

AuthTest marks a test as requiring authentication and applies appropriate handling

func CITest

func CITest(t *testing.T, testFunc func(t *testing.T))

CITest marks a test as CI-specific and applies appropriate handling

func FlakeResistant

func FlakeResistant(t *testing.T, testFunc func(t *testing.T))

FlakeResistant marks a test as potentially flaky and applies retry logic

func NetworkTest

func NetworkTest(t *testing.T, testFunc func(t *testing.T))

NetworkTest marks a test as requiring network access and applies appropriate handling

func WithRetry

func WithRetry(t *testing.T, testName string, config RetryConfig, testFunc RetryTestFunc)

WithRetry executes a test function with retry logic

func WithSimpleRetry

func WithSimpleRetry(t *testing.T, testName string, testFunc RetryTestFunc)

WithSimpleRetry provides a simpler interface for basic retry scenarios

Types

type RetryConfig

type RetryConfig struct {
	MaxAttempts int
	Delay       time.Duration
	Backoff     float64 // Multiplier for delay between attempts
}

RetryConfig configures test retry behavior

func DefaultRetryConfig

func DefaultRetryConfig() RetryConfig

DefaultRetryConfig returns a sensible default retry configuration

type RetryTestFunc

type RetryTestFunc func() error

RetryTestFunc represents a test function that can be retried

type TestConfig

type TestConfig struct {
	SkipNetworkTests bool
	SkipAuthTests    bool
	UseShallowClone  bool
	DefaultTimeout   time.Duration
	MaxRetries       int
	RetryDelay       time.Duration
	VerboseOutput    bool
	TestDataDir      string
	EnableMockRepos  bool
	GitHubToken      string
	TestRepositories []TestRepositoryConfig
}

TestConfig provides configuration for E2E tests

func GetTestConfig

func GetTestConfig() *TestConfig

GetTestConfig returns the test configuration based on environment variables

func (*TestConfig) GetTestRepository

func (c *TestConfig) GetTestRepository(name string) *TestRepositoryConfig

GetTestRepository returns a test repository by name

func (*TestConfig) ShouldSkipTest

func (c *TestConfig) ShouldSkipTest(testType string, requiresAuth bool, requiresNetwork bool) (bool, string)

ShouldSkipTest determines if a test should be skipped based on configuration

type TestRepositoryConfig

type TestRepositoryConfig struct {
	Name                string
	URL                 string
	Description         string
	ExpectedMinFiles    int
	ExpectedMaxDuration time.Duration
	ExpectedPITypes     []string
	ExpectedMinFindings int
	ExpectedMaxFindings int
	SkipIfNoAuth        bool
	RequireAuth         bool
}

TestRepositoryConfig configures individual test repositories

Jump to

Keyboard shortcuts

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