testutils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const TestInterval = 250 * time.Millisecond
View Source
const TestTimeout = 30 * time.Second

Variables

View Source
var E2NodeSetFixtures = []E2NodeSetFixture{
	{
		Name: "test-e2nodeset-small",

		Namespace: "default",

		Replicas: 1,

		Expected: nephoranv1.E2NodeSetStatus{
			ReadyReplicas: 1,
		},
	},

	{
		Name: "test-e2nodeset-medium",

		Namespace: "o-ran",

		Replicas: 3,

		Expected: nephoranv1.E2NodeSetStatus{
			ReadyReplicas: 3,
		},
	},

	{
		Name: "test-e2nodeset-large",

		Namespace: "o-ran",

		Replicas: 5,

		Expected: nephoranv1.E2NodeSetStatus{
			ReadyReplicas: 5,
		},
	},

	{
		Name: "test-e2nodeset-ha",

		Namespace: "o-ran-ha",

		Replicas: 7,

		Expected: nephoranv1.E2NodeSetStatus{
			ReadyReplicas: 7,
		},
	},
}
View Source
var NetworkIntentFixtures = []NetworkIntentFixture{
	{
		Name: "upf-deployment",

		Namespace: "5g-core",

		Intent: "Deploy UPF with 3 replicas for high availability",

		Expected: nephoranv1.NetworkIntentSpec{
			Intent: "Deploy UPF with 3 replicas for high availability",
		},
	},

	{
		Name: "amf-scaling",

		Namespace: "5g-core",

		Intent: "Scale AMF instances to 5 replicas to handle increased signaling load",

		Expected: nephoranv1.NetworkIntentSpec{
			Intent: "Scale AMF instances to 5 replicas to handle increased signaling load",
		},
	},

	{
		Name: "near-rt-ric-deployment",

		Namespace: "o-ran",

		Intent: "Set up Near-RT RIC with xApp support for intelligent traffic management",

		Expected: nephoranv1.NetworkIntentSpec{
			Intent: "Set up Near-RT RIC with xApp support for intelligent traffic management",
		},
	},

	{
		Name: "edge-computing-node",

		Namespace: "edge-apps",

		Intent: "Configure edge computing node with GPU acceleration for video processing",

		Expected: nephoranv1.NetworkIntentSpec{
			Intent: "Configure edge computing node with GPU acceleration for video processing",
		},
	},

	{
		Name: "upf-vertical-scaling",

		Namespace: "5g-core",

		Intent: "Increase UPF resources to 4 CPU cores and 8GB memory for high throughput",

		Expected: nephoranv1.NetworkIntentSpec{
			Intent: "Increase UPF resources to 4 CPU cores and 8GB memory for high throughput",
		},
	},
}

Functions

func AcquireConcurrencySlot

func AcquireConcurrencySlot(testName string) func()

func AssertE2NodeSetHasOwnerReference

func AssertE2NodeSetHasOwnerReference(ctx context.Context, k8sClient client.Client, e2ns *nephoranv1.E2NodeSet, expectedConfigMaps int)

func AssertNetworkIntentHasCondition

func AssertNetworkIntentHasCondition(ni *nephoranv1.NetworkIntent, conditionType string, status metav1.ConditionStatus, reason string)

func BatchCreateFiles

func BatchCreateFiles(baseDir string, files map[string][]byte) error

func CleanupGlobalOptimizers

func CleanupGlobalOptimizers()

func CleanupIsolatedNamespace

func CleanupIsolatedNamespace(namespaceName string)

CleanupIsolatedNamespace cleans up resources in an isolated test namespace.

func CleanupTestResources

func CleanupTestResources(ctx context.Context, k8sClient client.Client, namespace string)

func CreateConfigMap

func CreateConfigMap(ctx context.Context, k8sClient client.Client, name, namespace string, data, labels map[string]string) *corev1.ConfigMap

func CreateDeployedNetworkIntent

func CreateDeployedNetworkIntent(fixture NetworkIntentFixture) *nephoranv1.NetworkIntent

func CreateE2NodeSet

func CreateE2NodeSet(fixture E2NodeSetFixture) *nephoranv1.E2NodeSet

func CreateE2NodeSetWithAnnotations

func CreateE2NodeSetWithAnnotations(name, namespace string, replicas int32, annotations map[string]string) *nephoranv1.E2NodeSet

func CreateE2NodeSetWithCustomEndpoint

func CreateE2NodeSetWithCustomEndpoint(name, namespace string, replicas int32, ricEndpoint string) *nephoranv1.E2NodeSet

func CreateE2NodeSetWithFinalizer

func CreateE2NodeSetWithFinalizer(ctx context.Context, k8sClient client.Client, name, namespace string, replicas int32, finalizer string) *nephoranv1.E2NodeSet

func CreateIsolatedNamespace

func CreateIsolatedNamespace(prefix string) string

CreateIsolatedNamespace creates an isolated namespace for testing.

func CreateMinimalE2NodeSet

func CreateMinimalE2NodeSet(name, namespace string, replicas int32) *nephoranv1.E2NodeSet

func CreateNamespace

func CreateNamespace(ctx context.Context, k8sClient client.Client, name string) *corev1.Namespace

func CreateNetworkIntent

func CreateNetworkIntent(fixture NetworkIntentFixture) *nephoranv1.NetworkIntent

func CreateOptimizedTempDir

func CreateOptimizedTempDir(t testing.TB, prefix string) string

func CreateProcessedNetworkIntent

func CreateProcessedNetworkIntent(fixture NetworkIntentFixture) *nephoranv1.NetworkIntent

func CreateReadyE2NodeSet

func CreateReadyE2NodeSet(fixture E2NodeSetFixture) *nephoranv1.E2NodeSet

func CreateTestContext

func CreateTestContext() (context.Context, context.CancelFunc)

func CreateTestNamespace

func CreateTestNamespace() *corev1.Namespace

CreateTestNamespace creates a test namespace with auto-generated name.

func CreateTestNetworkIntent

func CreateTestNetworkIntent(name, namespace, intent string) *nephoranv1.NetworkIntent

CreateTestNetworkIntent creates a NetworkIntent for testing with custom intent text.

func CreateTestSecret

func CreateTestSecret(ctx context.Context, k8sClient client.Client, name, namespace string, data map[string][]byte) *corev1.Secret

func DeleteConfigMap

func DeleteConfigMap(ctx context.Context, k8sClient client.Client, name, namespace string)

func DeleteNamespace

func DeleteNamespace(ctx context.Context, k8sClient client.Client, name string)

func ExampleOptimizedCleanup

func ExampleOptimizedCleanup(t *testing.T)

func ExampleOptimizedFileCreation

func ExampleOptimizedFileCreation(t *testing.T)

func ExampleOptimizedIntegrationTest

func ExampleOptimizedIntegrationTest(t *testing.T)

func ExampleOptimizedParallelism

func ExampleOptimizedParallelism(t *testing.T)

func ExampleOptimizedTestData

func ExampleOptimizedTestData(t *testing.T)

func ExampleOptimizedTimeout

func ExampleOptimizedTimeout(t *testing.T)

func ExampleStandardCleanup

func ExampleStandardCleanup(t *testing.T)

func ExampleStandardFileCreation

func ExampleStandardFileCreation(t *testing.T)

func ExampleStandardIntegrationTest

func ExampleStandardIntegrationTest(t *testing.T)

func ExampleStandardParallelism

func ExampleStandardParallelism(t *testing.T)

func ExampleStandardTestData

func ExampleStandardTestData(t *testing.T)

func ExampleStandardTimeout

func ExampleStandardTimeout(t *testing.T)

func GenerateUniqueName

func GenerateUniqueName(prefix string) string

func GenerateUniqueNamespace

func GenerateUniqueNamespace(prefix string) string

func GetE2NodeSet

func GetE2NodeSet(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName) *nephoranv1.E2NodeSet

func GetE2NodeSetByLabels

func GetE2NodeSetByLabels(ctx context.Context, k8sClient client.Client, namespace string, labels map[string]string) ([]nephoranv1.E2NodeSet, error)

func GetE2NodeSetConfigMaps

func GetE2NodeSetConfigMaps(ctx context.Context, k8sClient client.Client, e2nodeSet *nephoranv1.E2NodeSet) (*corev1.ConfigMapList, error)

func GetE2NodeSetReadyReplicasCount

func GetE2NodeSetReadyReplicasCount(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName) int32

func GetNetworkIntent

func GetNetworkIntent(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName) *nephoranv1.NetworkIntent

func GetOptimizedContext

func GetOptimizedContext(ctx context.Context, baseTimeout time.Duration) (context.Context, context.CancelFunc)

func GetOptimizedTempDir

func GetOptimizedTempDir(t testing.TB, prefix string) string

func GetOptimizedTimeout

func GetOptimizedTimeout(baseTimeout time.Duration) time.Duration

func GetResourceCounts

func GetResourceCounts(ctx context.Context, k8sClient client.Client, namespace string) (map[string]int, error)

func GetUniqueName

func GetUniqueName(prefix string) string

GetUniqueName generates a unique name for test resources.

func IsConditionTrue

func IsConditionTrue(conditions []metav1.Condition, conditionType string) bool

IsConditionTrue checks if a condition is true in a list of conditions.

func NormalizePath

func NormalizePath(path string) string

func ReadFileOptimized

func ReadFileOptimized(filePath string) ([]byte, error)

func UpdateE2NodeSetReplicas

func UpdateE2NodeSetReplicas(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, newReplicas int32)

func UpdateE2NodeSetStatus

func UpdateE2NodeSetStatus(ctx context.Context, k8sClient client.Client, e2ns *nephoranv1.E2NodeSet)

func UpdateNetworkIntentStatus

func UpdateNetworkIntentStatus(ctx context.Context, k8sClient client.Client, ni *nephoranv1.NetworkIntent)

func VerifyE2NodeSetAnnotation

func VerifyE2NodeSetAnnotation(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, key, expectedValue string)

func VerifyE2NodeSetFinalizer

func VerifyE2NodeSetFinalizer(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, expectedFinalizer string, shouldExist bool)

func VerifyNoConfigMapOperations

func VerifyNoConfigMapOperations(ctx context.Context, k8sClient client.Client, namespace string, initialCount int)

func VerifyOwnerReferences

func VerifyOwnerReferences(ctx context.Context, k8sClient client.Client, owner client.Object, childObjects []client.Object) error

func VerifyResourceConsistency

func VerifyResourceConsistency(ctx context.Context, k8sClient client.Client, namespace string) error

func WaitForConditionWithReason

func WaitForConditionWithReason(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, conditionType, reason string)

func WaitForConfigMapCount

func WaitForConfigMapCount(ctx context.Context, k8sClient client.Client, namespace string, labelSelector map[string]string, expectedCount int)

func WaitForE2NodeSetDeletion

func WaitForE2NodeSetDeletion(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName)

func WaitForE2NodeSetFinalizer

func WaitForE2NodeSetFinalizer(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, finalizer string, shouldExist bool)

func WaitForE2NodeSetReady

func WaitForE2NodeSetReady(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, expectedReplicas int32)

func WaitForE2NodeSetScaling

func WaitForE2NodeSetScaling(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, targetReplicas int32)

func WaitForE2NodeSetStatusUpdate

func WaitForE2NodeSetStatusUpdate(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, checkFunc func(*nephoranv1.E2NodeSet) bool)

func WaitForMultipleE2NodeSetsReady

func WaitForMultipleE2NodeSetsReady(ctx context.Context, k8sClient client.Client, e2nodeSets []*nephoranv1.E2NodeSet, expectedReplicas []int32)

func WaitForMultipleNetworkIntentsProcessed

func WaitForMultipleNetworkIntentsProcessed(ctx context.Context, k8sClient client.Client, networkIntents []*nephoranv1.NetworkIntent)

func WaitForNetworkIntentMessage

func WaitForNetworkIntentMessage(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, expectedMessage string)

func WaitForNetworkIntentPhase

func WaitForNetworkIntentPhase(ctx context.Context, k8sClient client.Client, namespacedName types.NamespacedName, expectedPhase string)

func WaitForOwnerReferences

func WaitForOwnerReferences(ctx context.Context, k8sClient client.Client, owner client.Object, childObjects []client.Object)

func WaitForResourceConsistency

func WaitForResourceConsistency(ctx context.Context, k8sClient client.Client, namespace string)

func WaitForResourceDeletion

func WaitForResourceDeletion(ctx context.Context, k8sClient client.Client, obj client.Object)

func WithOptimizedTest

func WithOptimizedTest(t *testing.T, testFunc func(*testing.T, *TestContext))

func WithOptimizedTimeout

func WithOptimizedTimeout(ctx context.Context, baseTimeout time.Duration) (context.Context, context.CancelFunc)

func WriteFileOptimized

func WriteFileOptimized(filePath string, content []byte) error

Types

type BatchFileProcessor

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

func NewBatchFileProcessor

func NewBatchFileProcessor() *BatchFileProcessor

func (*BatchFileProcessor) CreateFiles

func (b *BatchFileProcessor) CreateFiles(baseDir string, files map[string][]byte) error

type E2NodeSetFixture

type E2NodeSetFixture struct {
	Name string

	Namespace string

	Replicas int32

	Expected nephoranv1.E2NodeSetStatus
}

func GetE2NodeSetByName

func GetE2NodeSetByName(name string) *E2NodeSetFixture

type EnhancedMockGitClient

type EnhancedMockGitClient = MockGitClient

func NewEnhancedMockGitClient

func NewEnhancedMockGitClient() *EnhancedMockGitClient

type MockDependencies

type MockDependencies struct {
	LLMClient *MockLLMClient

	GitClient *MockGitClient
}

func (*MockDependencies) GetEventRecorder

func (m *MockDependencies) GetEventRecorder() record.EventRecorder

func (*MockDependencies) GetGitClient

func (m *MockDependencies) GetGitClient() git.ClientInterface

func (*MockDependencies) GetHTTPClient

func (m *MockDependencies) GetHTTPClient() *http.Client

func (*MockDependencies) GetLLMClient

func (m *MockDependencies) GetLLMClient() shared.ClientInterface

func (*MockDependencies) GetMetricsCollector

func (m *MockDependencies) GetMetricsCollector() monitoring.MetricsCollector

func (*MockDependencies) GetPackageGenerator

func (m *MockDependencies) GetPackageGenerator() *nephio.PackageGenerator

func (*MockDependencies) GetTelecomKnowledgeBase

func (m *MockDependencies) GetTelecomKnowledgeBase() *telecom.TelecomKnowledgeBase

type MockDependenciesBuilder

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

func NewMockDependenciesBuilder

func NewMockDependenciesBuilder() *MockDependenciesBuilder

func (*MockDependenciesBuilder) Build

func (*MockDependenciesBuilder) WithGitClient

func (*MockDependenciesBuilder) WithLLMClient

type MockDependenciesComprehensive

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

type MockGitClient

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

func NewMockGitClient

func NewMockGitClient() *MockGitClient

func (*MockGitClient) Add

func (m *MockGitClient) Add(path string) error

func (*MockGitClient) AddRemote

func (m *MockGitClient) AddRemote(name, url string) error

func (*MockGitClient) ApplyPatch

func (m *MockGitClient) ApplyPatch(patch string) error

func (*MockGitClient) ApprovePullRequest

func (m *MockGitClient) ApprovePullRequest(id int) error

func (*MockGitClient) CherryPick

func (m *MockGitClient) CherryPick(commitHash string) error

func (*MockGitClient) Clean

func (m *MockGitClient) Clean(force bool) error

func (*MockGitClient) CommitAndPush

func (m *MockGitClient) CommitAndPush(files map[string]string, message string) (string, error)

func (*MockGitClient) CommitAndPushChanges

func (m *MockGitClient) CommitAndPushChanges(message string) error

func (*MockGitClient) CommitFiles

func (m *MockGitClient) CommitFiles(files []string, msg string) error

func (*MockGitClient) CreateBranch

func (m *MockGitClient) CreateBranch(name string) error

func (*MockGitClient) CreatePatch

func (m *MockGitClient) CreatePatch(options git.DiffOptions) (string, error)

func (*MockGitClient) CreatePullRequest

func (m *MockGitClient) CreatePullRequest(options git.PullRequestOptions) (git.PullRequestInfo, error)

func (*MockGitClient) CreateTag

func (m *MockGitClient) CreateTag(name, message string) error

func (*MockGitClient) DeleteBranch

func (m *MockGitClient) DeleteBranch(name string) error

func (*MockGitClient) Fetch

func (m *MockGitClient) Fetch(remote string) error

func (*MockGitClient) GetCallLog

func (m *MockGitClient) GetCallLog() []string

func (*MockGitClient) GetCommitCount

func (m *MockGitClient) GetCommitCount() int

func (*MockGitClient) GetCommitHistory

func (m *MockGitClient) GetCommitHistory(options git.LogOptions) ([]git.CommitInfo, error)

func (*MockGitClient) GetCommits

func (m *MockGitClient) GetCommits() []string

func (*MockGitClient) GetCurrentBranch

func (m *MockGitClient) GetCurrentBranch() (string, error)

func (*MockGitClient) GetDiff

func (m *MockGitClient) GetDiff(options git.DiffOptions) (string, error)

func (*MockGitClient) GetFileContent

func (m *MockGitClient) GetFileContent(path string) ([]byte, error)

func (*MockGitClient) GetFileContentString

func (m *MockGitClient) GetFileContentString(filePath string) string

func (*MockGitClient) GetLastCommitHash

func (m *MockGitClient) GetLastCommitHash() string

func (*MockGitClient) GetLog

func (m *MockGitClient) GetLog(options git.LogOptions) ([]git.CommitInfo, error)

func (*MockGitClient) GetPullRequestStatus

func (m *MockGitClient) GetPullRequestStatus(id int) (string, error)

func (*MockGitClient) GetRemotes

func (m *MockGitClient) GetRemotes() ([]git.RemoteInfo, error)

func (*MockGitClient) GetStatus

func (m *MockGitClient) GetStatus() ([]git.StatusInfo, error)

func (*MockGitClient) GetTagInfo

func (m *MockGitClient) GetTagInfo(name string) (git.TagInfo, error)

func (*MockGitClient) InitRepo

func (m *MockGitClient) InitRepo() error

func (*MockGitClient) ListBranches

func (m *MockGitClient) ListBranches() ([]string, error)

func (*MockGitClient) ListTags

func (m *MockGitClient) ListTags() ([]git.TagInfo, error)

func (*MockGitClient) MergeBranch

func (m *MockGitClient) MergeBranch(sourceBranch, targetBranch string) error

func (*MockGitClient) MergePullRequest

func (m *MockGitClient) MergePullRequest(id int) error

func (*MockGitClient) Move

func (m *MockGitClient) Move(oldPath, newPath string) error

func (*MockGitClient) Pull

func (m *MockGitClient) Pull(remote string) error

func (*MockGitClient) Push

func (m *MockGitClient) Push(remote string) error

func (*MockGitClient) RebaseBranch

func (m *MockGitClient) RebaseBranch(sourceBranch, targetBranch string) error

func (*MockGitClient) Remove

func (m *MockGitClient) Remove(path string) error

func (*MockGitClient) RemoveDirectory

func (m *MockGitClient) RemoveDirectory(path, commitMessage string) error

func (*MockGitClient) RemoveRemote

func (m *MockGitClient) RemoveRemote(name string) error

func (*MockGitClient) Reset

func (m *MockGitClient) Reset(options git.ResetOptions) error

func (*MockGitClient) ResetMock

func (m *MockGitClient) ResetMock()

func (*MockGitClient) Restore

func (m *MockGitClient) Restore(path string) error

func (*MockGitClient) SetCommitHash

func (m *MockGitClient) SetCommitHash(hash string)

func (*MockGitClient) SetCommitPushError

func (m *MockGitClient) SetCommitPushError(err error)

func (*MockGitClient) SetInitError

func (m *MockGitClient) SetInitError(err error)

func (*MockGitClient) SwitchBranch

func (m *MockGitClient) SwitchBranch(name string) error

type MockGitClientComprehensive

type MockGitClientComprehensive = MockGitClient

type MockGitClientInterface

type MockGitClientInterface = MockGitClient

type MockLLMClient

type MockLLMClient struct {
	Error error // Public field for direct error control in tests
	// contains filtered or unexported fields
}

func NewMockLLMClient

func NewMockLLMClient() *MockLLMClient

func (*MockLLMClient) Close

func (m *MockLLMClient) Close() error

func (*MockLLMClient) EstimateTokens

func (m *MockLLMClient) EstimateTokens(text string) int

func (*MockLLMClient) GetCallCount

func (m *MockLLMClient) GetCallCount() int

func (*MockLLMClient) GetEndpoint

func (m *MockLLMClient) GetEndpoint() string

GetEndpoint implements the shared.ClientInterface.

func (*MockLLMClient) GetError

func (m *MockLLMClient) GetError() error

func (*MockLLMClient) GetLastIntent

func (m *MockLLMClient) GetLastIntent() string

func (*MockLLMClient) GetMaxTokens

func (m *MockLLMClient) GetMaxTokens(modelName string) int

func (*MockLLMClient) GetModelCapabilities

func (m *MockLLMClient) GetModelCapabilities() shared.ModelCapabilities

GetModelCapabilities implements the shared.ClientInterface.

func (*MockLLMClient) GetStatus

func (m *MockLLMClient) GetStatus() shared.ClientStatus

GetStatus implements the shared.ClientInterface.

func (*MockLLMClient) GetSupportedModels

func (m *MockLLMClient) GetSupportedModels() []string

func (*MockLLMClient) HealthCheck

func (m *MockLLMClient) HealthCheck(ctx context.Context) error

HealthCheck implements the shared.ClientInterface.

func (*MockLLMClient) ProcessIntent

func (m *MockLLMClient) ProcessIntent(ctx context.Context, intent string) (string, error)

func (*MockLLMClient) ProcessIntentStream

func (m *MockLLMClient) ProcessIntentStream(ctx context.Context, prompt string, chunks chan<- *shared.StreamingChunk) error

func (*MockLLMClient) ProcessRequest

func (m *MockLLMClient) ProcessRequest(ctx context.Context, request *shared.LLMRequest) (*shared.LLMResponse, error)

ProcessRequest implements the shared.ClientInterface.

func (*MockLLMClient) ProcessStreamingRequest

func (m *MockLLMClient) ProcessStreamingRequest(ctx context.Context, request *shared.LLMRequest) (<-chan *shared.StreamingChunk, error)

ProcessStreamingRequest implements the shared.ClientInterface.

func (*MockLLMClient) ResetMock

func (m *MockLLMClient) ResetMock()

func (*MockLLMClient) SetError

func (m *MockLLMClient) SetError(intent string, err error)

func (*MockLLMClient) SetProcessingDelay

func (m *MockLLMClient) SetProcessingDelay(delay time.Duration)

func (*MockLLMClient) SetResponse

func (m *MockLLMClient) SetResponse(intent, response string)

func (*MockLLMClient) SetShouldReturnError

func (m *MockLLMClient) SetShouldReturnError(shouldError bool)

func (*MockLLMClient) ValidateModel

func (m *MockLLMClient) ValidateModel(modelName string) error

type MockLLMClientInterface

type MockLLMClientInterface = MockLLMClient

type NetworkIntentFixture

type NetworkIntentFixture struct {
	Name string

	Namespace string

	Intent string

	Expected nephoranv1.NetworkIntentSpec
}

func GetNetworkIntentByName

func GetNetworkIntentByName(name string) *NetworkIntentFixture

type OptimizedTestRunner

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

func NewOptimizedTestRunner

func NewOptimizedTestRunner() *OptimizedTestRunner

func (*OptimizedTestRunner) RunOptimizedTest

func (r *OptimizedTestRunner) RunOptimizedTest(t *testing.T, testFunc func(*testing.T, *TestContext))

type TestContext

type TestContext struct {
	T *testing.T

	TempDir string

	Optimizer *WindowsTestOptimizer

	BatchProc *BatchFileProcessor

	ResourceMgr *TestResourcePool
	// contains filtered or unexported fields
}

func (*TestContext) AddCleanup

func (tc *TestContext) AddCleanup(fn func())

func (*TestContext) Cleanup

func (tc *TestContext) Cleanup()

func (*TestContext) CreateTempFile

func (tc *TestContext) CreateTempFile(name string, content []byte) string

func (*TestContext) CreateTempFiles

func (tc *TestContext) CreateTempFiles(files map[string][]byte) map[string]string

func (*TestContext) GetOptimizedContext

func (tc *TestContext) GetOptimizedContext(baseTimeout time.Duration) (context.Context, context.CancelFunc)

type TestMetricsCollector

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

func NewTestMetricsCollector

func NewTestMetricsCollector() *TestMetricsCollector

func (*TestMetricsCollector) GetAverageDuration

func (m *TestMetricsCollector) GetAverageDuration(prefix string) time.Duration

func (*TestMetricsCollector) PrintSummary

func (m *TestMetricsCollector) PrintSummary()

func (*TestMetricsCollector) RecordTestCompletion

func (m *TestMetricsCollector) RecordTestCompletion(testName string, duration time.Duration)

type TestResourcePool

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

func NewTestResourcePool

func NewTestResourcePool() *TestResourcePool

func (*TestResourcePool) CacheDirectory

func (p *TestResourcePool) CacheDirectory(key, path string)

func (*TestResourcePool) CacheFile

func (p *TestResourcePool) CacheFile(path string, content []byte)

func (*TestResourcePool) Clear

func (p *TestResourcePool) Clear()

func (*TestResourcePool) GetCachedDirectory

func (p *TestResourcePool) GetCachedDirectory(key string) (string, bool)

func (*TestResourcePool) GetCachedFile

func (p *TestResourcePool) GetCachedFile(path string) ([]byte, bool)

type WindowsConcurrencyManager

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

func NewWindowsConcurrencyManager

func NewWindowsConcurrencyManager() *WindowsConcurrencyManager

func (*WindowsConcurrencyManager) AcquireSlot

func (w *WindowsConcurrencyManager) AcquireSlot(testName string) func()

func (*WindowsConcurrencyManager) GetActiveTests

func (w *WindowsConcurrencyManager) GetActiveTests() int

type WindowsFileSystemOptimizer

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

func NewWindowsFileSystemOptimizer

func NewWindowsFileSystemOptimizer() *WindowsFileSystemOptimizer

type WindowsPathNormalizer

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

func NewWindowsPathNormalizer

func NewWindowsPathNormalizer() *WindowsPathNormalizer

func (*WindowsPathNormalizer) GetShortPath

func (w *WindowsPathNormalizer) GetShortPath(path string) string

func (*WindowsPathNormalizer) NormalizePath

func (w *WindowsPathNormalizer) NormalizePath(path string) string

type WindowsTestOptimizer

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

func NewWindowsTestOptimizer

func NewWindowsTestOptimizer() *WindowsTestOptimizer

func (*WindowsTestOptimizer) BulkFileCreation

func (w *WindowsTestOptimizer) BulkFileCreation(baseDir string, files map[string][]byte) error

func (*WindowsTestOptimizer) Cleanup

func (w *WindowsTestOptimizer) Cleanup()

func (*WindowsTestOptimizer) OptimizedContextTimeout

func (w *WindowsTestOptimizer) OptimizedContextTimeout(ctx context.Context, baseTimeout time.Duration) (context.Context, context.CancelFunc)

func (*WindowsTestOptimizer) OptimizedFileRead

func (w *WindowsTestOptimizer) OptimizedFileRead(filePath string) ([]byte, error)

func (*WindowsTestOptimizer) OptimizedFileWrite

func (w *WindowsTestOptimizer) OptimizedFileWrite(filePath string, content []byte) error

func (*WindowsTestOptimizer) OptimizedTempDir

func (w *WindowsTestOptimizer) OptimizedTempDir(t testing.TB, prefix string) string

func (*WindowsTestOptimizer) OptimizedTestTimeout

func (w *WindowsTestOptimizer) OptimizedTestTimeout(baseTimeout time.Duration) time.Duration

Jump to

Keyboard shortcuts

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